code: def construct_feature_group_to_be_merged(
      target_feature_group: FeatureGroup,
      included_feature_names: List[str],
      target_feature_name_in_base: str = None,
      feature_name_in_target: str = None,
      join_comparator: JoinComparatorEnum = JoinComparatorEnum.EQUALS,
      join_type: JoinTypeEnum = JoinTypeEnum.INNER_JOIN,
  ) -> FeatureGroupToBeMerged:
      """Construct a FeatureGroupToBeMerged object by provided parameters.
  
      Args:
          feature_group (FeatureGroup): A FeatureGroup object.
          included_feature_names (List[str]): A list of strings representing features to be
              included in the output.
          target_feature_name_in_base (str): A string representing the feature name in base which
              will be used as target join key (default: None).
          feature_name_in_target (str): A string representing the feature name in the target feature
              group that will be compared to the target feature in the base feature group.
              If None is provided, the record identifier feature will be used in the
              SQL join. (default: None).
          join_comparator (JoinComparatorEnum): A JoinComparatorEnum representing the comparator
              used when joining the target feature in the base feature group and the feature
              in the target feature group. (default: JoinComparatorEnum.EQUALS).
          join_type (JoinTypeEnum): A JoinTypeEnum representing the type of join between
              the base and target feature groups. (default: JoinTypeEnum.INNER_JOIN).
      Returns:
          A FeatureGroupToBeMerged object.
  
      Raises:
          ValueError: Invalid feature name(s) in included_feature_names.
      """
      feature_group_metadata = target_feature_group.describe()
      data_catalog_config = feature_group_metadata.get(
          "OfflineStoreConfig", {}
      ).get("DataCatalogConfig", None)
      if not data_catalog_config:
          raise RuntimeError(
              f"No metastore is configured with FeatureGroup {target_feature_group.name}."
          )
  
      record_identifier_feature_name = feature_group_metadata.get(
          "RecordIdentifierFeatureName", None
      )
      feature_definitions = feature_group_metadata.get(
          "FeatureDefinitions", []
      )
      event_time_identifier_feature_name = feature_group_metadata.get(
          "EventTimeFeatureName", None
      )
      event_time_identifier_feature_type = FeatureTypeEnum(
          next(
              filter(
                  lambda f: f.get("FeatureName", None)
                  == event_time_identifier_feature_name,
                  feature_definitions,
              ),
              {},
          ).get("FeatureType", None)
      )
      table_name = data_catalog_config.get("TableName", None)
      database = data_catalog_config.get("Database", None)
      disable_glue = feature_group_metadata.get(
          "DisableGlueTableCreation", False
      )
      catalog = (
          data_catalog_config.get("Catalog", None)
          if disable_glue
          else _DEFAULT_CATALOG
      )
      features = [
          feature.get("FeatureName", None)
          for feature in feature_definitions
      ]
  
      if (
          feature_name_in_target is not None
          and feature_name_in_target not in features
      ):
          raise ValueError(
              f"Feature {feature_name_in_target} not found in FeatureGroup {target_feature_group.name}"
          )
  
      for included_feature in included_feature_names or []:
          if included_feature not in features:
              raise ValueError(
                  f"Feature {included_feature} not found in FeatureGroup {target_feature_group.name}"
              )
      if not included_feature_names:
          included_feature_names = features
          projected_feature_names = features.copy()
      else:
          projected_feature_names = included_feature_names.copy()
          if (
              record_identifier_feature_name
              not in included_feature_names
          ):
              included_feature_names.append(
                  record_identifier_feature_name
              )
          if (
              event_time_identifier_feature_name
              not in included_feature_names
          ):
              included_feature_names.append(
                  event_time_identifier_feature_name
              )
      return FeatureGroupToBeMerged(
          features,
          included_feature_names,
          projected_feature_names,
          catalog,
          database,
          table_name,
          record_identifier_feature_name,
          FeatureDefinition(
              event_time_identifier_feature_name,
              event_time_identifier_feature_type,
          ),
          target_feature_name_in_base,
          TableType.FEATURE_GROUP,
          feature_name_in_target,
          join_comparator,
          join_type,
      )
  
imports: from __future__ import absolute_import
  import datetime
  from enum import Enum
  import os
  from typing import Any, Dict, List, Tuple, Union
  import attr
  import pandas
  from sagemaker import Session, s3, utils
  from sagemaker.feature_store.feature_group import FeatureDefinition, FeatureGroup, FeatureTypeEnum
label_desc: Use image node_id 1 for calling a global function with example usage: construct_feature_group_to_be_merged(target_feature_group, included_feature_names, target_feature_name_in_base, feature_name_in_target, join_comparator, join_type) and returns: FeatureGroupToBeMerged