code: def _create_pipeline(
      pipeline_name: str,
      pipeline_root: str,
      data_root_1: str,
      data_root_2: str,
  ) -> pipeline.Pipeline:
      """Implements a pipeline with channel.union()."""
      # Brings data into the pipeline or otherwise joins/converts training data.
      example_gen_1 = CsvExampleGen(input_base=data_root_1).with_id(
          "example_gen_1"
      )
      example_gen_2 = CsvExampleGen(input_base=data_root_2).with_id(
          "example_gen_2"
      )
  
      # pylint: disable=no-value-for-parameter
      channel_union = ChannelUnionComponent(
          input_data=channel.union(
              [
                  example_gen_1.outputs["examples"],
                  example_gen_2.outputs["examples"],
              ]
          ),
          name="channel_union_input",
      )
  
      # Get the latest channel.
      latest_artifacts_resolver = resolver.Resolver(
          strategy_class=latest_artifact_strategy.LatestArtifactStrategy,
          resolved_channels=channel.union(
              [
                  example_gen_1.outputs["examples"],
                  channel_union.outputs["output_data"],
              ]
          ),
      ).with_id("latest_artifacts_resolver")
  
      # Computes statistics over data for visualization and example validation.
      statistics_gen = StatisticsGen(
          examples=latest_artifacts_resolver.outputs[
              "resolved_channels"
          ]
      )
      return pipeline.Pipeline(
          pipeline_name=pipeline_name,
          pipeline_root=pipeline_root,
          components=[
              example_gen_1,
              example_gen_2,
              channel_union,
              latest_artifacts_resolver,
              statistics_gen,
          ],
      )
  
file_path: tfx/tfx/dsl/compiler/testdata/channel_union_pipeline.py
imports: import os
  from tfx.components import CsvExampleGen
  from tfx.components import StatisticsGen
  from tfx.dsl.component.experimental import annotations
  from tfx.dsl.component.experimental.decorators import component
  from tfx.dsl.components.common import resolver
  from tfx.dsl.input_resolution.strategies import latest_artifact_strategy
  from tfx.orchestration import pipeline
  from tfx.types import channel
  from tfx.types import standard_artifacts
label_desc: Use image node_id 2 for calling a global function with example usage: _create_pipeline(pipeline_name, pipeline_root, data_root_1, data_root_2) and returns: pipeline