Reputation: 2431
I want to concatenate the value of two ValueProvider<String>
and assign it to a new ValueProvider<String>
How I can achieve it?
ValueProvider<String> A; //if A = Nikhil;
ValueProvider<String> B; //if B = Suthar;
ValueProvider<String> C = A + B; //Then C = Nikhil Suthar;
Upvotes: 0
Views: 371
Reputation: 5104
You could also look into using flex templates instead, which avoid having to worry about ValueProviders at all.
Upvotes: 0
Reputation: 1428
You can combine different providers into one, see this as an example: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v1/src/main/java/com/google/cloud/teleport/util/DualInputNestedValueProvider.java.
Upvotes: 2
Reputation: 1357
This question comes up from time to time (see Dataflow. ValueProvider. How to create from several options? for example) but there is not currently support for combining ValueProviders in the Beam Java SDK. NestedValueProvider
is available for transforming a runtime parameter, but it doesn't support multiple inputs.
Upvotes: 0
Reputation: 86
The ValueProvider provides a get() method (see Apache Beam). So you can do sth like this:
ValueProvider<String> a;
ValueProvider<String> b;
String c = a.get() + b.get();
Upvotes: 0