beam icon indicating copy to clipboard operation
beam copied to clipboard

[Bug]: DualInputNestedValueProvider is not able to get Value properly if input is RuntimeValueProvider.

Open keyliug opened this issue 1 year ago • 3 comments

What happened?

Background: DualInputNestedValueProvider https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/c7cb59f37766b7edfd0eb14f6f184f7c13b7909b/v1/src/main/java/com/google/cloud/teleport/util/DualInputNestedValueProvider.java#L29 is not in Apache Beam package. However, it uses ValueProvider from SDK.

The issue: If one of the input for DualInputNestedValueProvider is RuntimeValueProvider, then the input will still be a ValueProvider in input.getX() or input.getY() while we're expecting the real value of the ValueProvider should be fetched by the call.

Issue Priority

Priority: 3 (minor)

Issue Components

  • [ ] Component: Python SDK
  • [X] Component: Java SDK
  • [ ] Component: Go SDK
  • [ ] Component: Typescript SDK
  • [ ] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [ ] Component: Samza Runner
  • [ ] Component: Twister2 Runner
  • [ ] Component: Hazelcast Jet Runner
  • [ ] Component: Google Cloud Dataflow Runner

keyliug avatar Feb 08 '24 18:02 keyliug

DualInputNestedValueProvider is not able to get Value properly

Is your code requesting the value happening in job submission time (e.g. pipeline expansion, transform's configuration) or run time (e.g. in processElement of a DoFn) ? If it is the latter, this WAI as RuntimeValueProvider's value weren't be available during pipeline submission time

Abacn avatar Feb 08 '24 19:02 Abacn

The code is requesting the value at the runtime (e.g. in processElement of a DoFn).

keyliug avatar Feb 08 '24 19:02 keyliug

In my case, when I was using DualInputNestedValueProvider, both X and Y are of the same type, ValueProvider<String>. When we're doing input.getX() and input.getY(), we are expecting to get the value. However, if X or Y is RuntimeValueProvider, input.getY() is still ValueProvider instead of String type. Screenshot 2024-02-08 at 12 51 12 PM

keyliug avatar Feb 08 '24 20:02 keyliug