ahmedabu98 commented on code in PR #36045: URL: https://github.com/apache/beam/pull/36045#discussion_r2337763633
########## sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromMySqlSchemaTransformProvider.java: ########## @@ -43,4 +51,31 @@ public String description() { protected String jdbcType() { return MYSQL; } + + @Override + public @UnknownKeyFor @NonNull @Initialized SchemaTransform from( + JdbcReadSchemaTransformConfiguration configuration) { + String jdbcType = configuration.getJdbcType(); + if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) { + throw new IllegalArgumentException( + String.format("Wrong JDBC type. Expected '%s' but got '%s'", jdbcType(), jdbcType)); + } + + Integer fetchSize = configuration.getFetchSize(); + if (fetchSize != null + && fetchSize > 0 + && configuration.getJdbcUrl() != null + && !configuration.getJdbcUrl().contains("useCursorFetch=true")) { + LOG.warn( + "The fetchSize option is ignored. It is required to set useCursorFetch=true" + + " in the JDBC URL when using fetchSize for MySQL"); Review Comment: Consider failing instead of just logging a warning? ########## sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromMySqlSchemaTransformProvider.java: ########## @@ -43,4 +51,31 @@ public String description() { protected String jdbcType() { return MYSQL; } + + @Override + public @UnknownKeyFor @NonNull @Initialized SchemaTransform from( + JdbcReadSchemaTransformConfiguration configuration) { + String jdbcType = configuration.getJdbcType(); + if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) { + throw new IllegalArgumentException( + String.format("Wrong JDBC type. Expected '%s' but got '%s'", jdbcType(), jdbcType)); + } Review Comment: Wondering if we should just be ignoring the `jdbcType` parameter. It seems irrelevant if users specifically choose MySQL using SchemaTransform/Managed API -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org