LaVOZs

The World’s Largest Online Community for Developers

'; How get the value of ValueProvider parameter for add a RowFilter in BigtableIO.read with Java and Apache Beam - LavOzs.Com

I am trying to build a rowFilter using the object rowKeyRegexFilter. How do i get the string value for the ValueProvider parameter to build the rowKeyRegexFilter?

I modified a Dataflow template to copy data from Bigtable to Avro (Java and Apache Beam), i added a RowFilter to the BigtableIO.read using a rowKeyRegexFilter, i need the regex to be a runtime parameter.

BigtableIO.Read read =
                BigtableIO.read()
                        .withProjectId(options.getBigtableProjectId())
                        .withInstanceId(options.getBigtableInstanceId())
                        .withTableId(options.getBigtableTableId())
.withRowFilter(RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8(options.getRegex().get())).build());

But I can't get the value and it shows me the following error:

java.lang.IllegalStateException: Value only available at runtime, but accessed from a non-runtime context: RuntimeValueProvider{propertyName=regex, default=null}

Related
How to get an enum value from a string value in Java?
Does Java support default parameter values?
How do I determine whether an array contains a particular value in Java?
Apache Beam: why is the timestamp of aggregate value in Global Window 9223371950454775?
Extract value from ValueProvider in Apache Beam
Using run time parameters with BigtableIO in Apache Beam
I get error: “Overload resolution ambiguity” from MapElements transform in Apache Beam when using Kotlin
Spring with Apache Beam