[
https://issues.apache.org/jira/browse/BEAM-5191?focusedWorklogId=278948&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-278948
]
ASF GitHub Bot logged work on BEAM-5191:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Jul/19 12:31
Start Date: 18/Jul/19 12:31
Worklog Time Spent: 10m
Work Description: jklukas commented on pull request #8945: [BEAM-5191]
Support for BigQuery clustering
URL: https://github.com/apache/beam/pull/8945#discussion_r304889247
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/CreateTables.java
##########
@@ -130,6 +130,16 @@ private TableDestination
getTableDestination(ProcessContext context, Destination
dynamicDestinations,
tableDestination,
destination);
+ boolean destinationCoderSupportsClustering =
+ !(dynamicDestinations.getDestinationCoder() instanceof
TableDestinationCoderV2);
+ checkArgument(
+ tableDestination.getClustering() == null ||
destinationCoderSupportsClustering,
+ "DynamicDestinations.getTable() may only return destinations with
clustering configured"
+ + " if a destination coder is supplied that supports clustering,
but %s is configured"
+ + " to use TableDestinationCoderV2. Set withClustering() on
BigQueryIO.write() and, "
+ + " if you provided a custom DynamicDestinations instance,
override"
+ + " getDestinationCoder() to return TableDestinationCoderV3.",
+ dynamicDestinations);
Review comment:
We cannot know at compile-time whether a custom table function or
DynamicDestinations instance will produce any destination with clustering
enabled, so we have to check the produced destinations at runtime.
This check will cause a runtime failure for StreamingInserts if a clustered
destination is produced without the relevant configuration to use the newer
destination coder.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 278948)
Time Spent: 13h 50m (was: 13h 40m)
> Add support for writing to BigQuery clustered tables
> ----------------------------------------------------
>
> Key: BEAM-5191
> URL: https://issues.apache.org/jira/browse/BEAM-5191
> Project: Beam
> Issue Type: Improvement
> Components: io-java-gcp
> Affects Versions: 2.6.0
> Reporter: Robert Sahlin
> Assignee: Wout Scheepers
> Priority: Minor
> Labels: features, newbie
> Time Spent: 13h 50m
> Remaining Estimate: 0h
>
> Google recently added support for clustered tables in BigQuery. It would be
> useful to set clustering columns the same way as for partitioning. It should
> support multiple fields (4) for clustering.
> For example:
> [BigQueryIO.Write|https://beam.apache.org/documentation/sdks/javadoc/2.6.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.Write.html]<[T|https://beam.apache.org/documentation/sdks/javadoc/2.6.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.Write.html]>
> .withClustering(new Clustering().setField("productId").setType("STRING"))
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)