mutianf commented on code in PR #28288:
URL: https://github.com/apache/beam/pull/28288#discussion_r1330180787
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -688,14 +688,13 @@ public final String toString() {
private void validateTableExists(
BigtableConfig config, BigtableReadOptions readOptions,
PipelineOptions options) {
if (config.getValidate() && config.isDataAccessible() &&
readOptions.isDataAccessible()) {
- String tableId = checkNotNull(readOptions.getTableId().get());
+ ValueProvider<String> tableIdProvider =
checkArgumentNotNull(readOptions.getTableId());
+ String tableId = checkArgumentNotNull(tableIdProvider.get());
try {
- checkArgument(
- getServiceFactory().checkTableExists(config, options, tableId),
- "Table %s does not exist",
- tableId);
+ boolean exists = getServiceFactory().checkTableExists(config,
options, tableId);
+ checkArgument(exists, "Table %s does not exist", tableId);
} catch (IOException e) {
- LOG.warn("Error checking whether table {} exists; proceeding.",
tableId, e);
+ throw new IllegalArgumentException(e);
Review Comment:
Can you make the exception more descriptive? Or log the error first? I also
think we should re-throw IOException instead of changing it to a
IllegalArgumentException because it's not an issue with the argument.
--
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]