ahmedabu98 commented on code in PR #30460:
URL: https://github.com/apache/beam/pull/30460#discussion_r1541909816
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -2826,8 +2826,18 @@ public Write<T>
withJsonTimePartitioning(ValueProvider<String> partitioning) {
* tables, the fields here will be ignored; call {@link #withClustering()}
instead.
*/
public Write<T> withClustering(Clustering clustering) {
+ return
withJsonClustering(StaticValueProvider.of(BigQueryHelpers.toJsonString(clustering)));
+ }
+
+ /** Like {@link #withClustering(Clustering)} but using a deferred {@link
ValueProvider}. */
+ public Write<T> withClustering(ValueProvider<Clustering> clustering) {
+ return withJsonClustering(NestedValueProvider.of(clustering,
BigQueryHelpers::toJsonString));
+ }
+
+ /** The same as {@link #withClustering(Clustering)}, but takes a
JSON-serialized object. */
Review Comment:
Thanks, added
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java:
##########
@@ -455,8 +454,8 @@ public Row toConfigRow(Write<?> transform) {
fieldValues.put(
"json_time_partitioning",
toByteArray(transform.getJsonTimePartitioning().get()));
}
- if (transform.getClustering() != null) {
- fieldValues.put("clustering", toByteArray(transform.getClustering()));
+ if (transform.getJsonClustering() != null) {
Review Comment:
Ended up using another workaround so we can keep using the same field name
and type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]