shunping commented on code in PR #36045:
URL: https://github.com/apache/beam/pull/36045#discussion_r2356021309


##########
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:
   Done.



-- 
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

Reply via email to