kennknowles commented on a change in pull request #16644:
URL: https://github.com/apache/beam/pull/16644#discussion_r795314166
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageSourceBase.java
##########
@@ -107,17 +104,19 @@
BigQueryOptions bqOptions = options.as(BigQueryOptions.class);
Table targetTable = getTargetTable(bqOptions);
- String tableReferenceId = "";
+ ReadSession.Builder readSessionBuilder = ReadSession.newBuilder();
if (targetTable != null) {
- tableReferenceId =
BigQueryHelpers.toTableResourceName(targetTable.getTableReference());
+ readSessionBuilder.setTable(
+
BigQueryHelpers.toTableResourceName(targetTable.getTableReference()));
} else {
// If the table does not exist targetTable will be null.
// Construct the table id if we can generate it. For error
recording/logging.
- tableReferenceId = getTargetTableId(bqOptions);
+ @Nullable String tableReferenceId = getTargetTableId(bqOptions);
Review comment:
Yea I found the design less than idea. There are two subclasses of this
and one of them implements the method by just returning `null`. Basically it is
a difference between a read of a table vs a read of a query.
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageSourceBase.java
##########
@@ -107,17 +104,19 @@
BigQueryOptions bqOptions = options.as(BigQueryOptions.class);
Table targetTable = getTargetTable(bqOptions);
- String tableReferenceId = "";
+ ReadSession.Builder readSessionBuilder = ReadSession.newBuilder();
if (targetTable != null) {
- tableReferenceId =
BigQueryHelpers.toTableResourceName(targetTable.getTableReference());
+ readSessionBuilder.setTable(
+
BigQueryHelpers.toTableResourceName(targetTable.getTableReference()));
} else {
// If the table does not exist targetTable will be null.
// Construct the table id if we can generate it. For error
recording/logging.
- tableReferenceId = getTargetTableId(bqOptions);
+ @Nullable String tableReferenceId = getTargetTableId(bqOptions);
Review comment:
Yea I found the design less than ideal. There are two subclasses of this
and one of them implements the method by just returning `null`. Basically it is
a difference between a read of a table vs a read of a query.
--
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]