lukecwik commented on code in PR #23444:
URL: https://github.com/apache/beam/pull/23444#discussion_r984986855


##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java:
##########
@@ -666,7 +666,10 @@ public ReadRows 
withStatementPreparator(StatementPreparator statementPreparator)
      * It should ONLY be used if the default value throws memory errors.
      */
     public ReadRows withFetchSize(int fetchSize) {
-      checkArgument(fetchSize > 0, "fetch size must be > 0");
+      // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values greater than >= 0 and that MySQL supports using Integer.MIN_VALUE as a 
hint to stream the ResultSet instead of loading it into memory. See 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
+      checkArgument(
+          fetchSize > 0 || fetchSize == Integer.MIN_VALUE,
+          "fetch size must be > 0 or equal to Integer.MIN_VALUE");

Review Comment:
   ```suggestion
         // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values >= 0
         // and that MySQL supports using Integer.MIN_VALUE as a hint to stream 
the ResultSet instead
         // of loading it into memory. See
         // 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
          checkArgument(
             fetchSize >= 0 || fetchSize == Integer.MIN_VALUE,
             "fetch size must be >= 0 or equal to Integer.MIN_VALUE");
   ```



##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java:
##########
@@ -808,7 +811,10 @@ public Read<T> withCoder(Coder<T> coder) {
      * It should ONLY be used if the default value throws memory errors.
      */
     public Read<T> withFetchSize(int fetchSize) {
-      checkArgument(fetchSize > 0, "fetch size must be > 0");
+      // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values greater than >= 0 and that MySQL supports using Integer.MIN_VALUE as a 
hint to stream the ResultSet instead of loading it into memory. See 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
+      checkArgument(
+          fetchSize > 0 || fetchSize == Integer.MIN_VALUE,
+          "fetch size must be > 0 or equal to Integer.MIN_VALUE");

Review Comment:
   ```suggestion
         // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values >= 0
         // and that MySQL supports using Integer.MIN_VALUE as a hint to stream 
the ResultSet instead
         // of loading it into memory. See
         // 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
          checkArgument(
             fetchSize >= 0 || fetchSize == Integer.MIN_VALUE,
             "fetch size must be >= 0 or equal to Integer.MIN_VALUE");
   ```



##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java:
##########
@@ -961,7 +967,10 @@ public ReadAll<ParameterT, OutputT> 
withCoder(Coder<OutputT> coder) {
      * It should ONLY be used if the default value throws memory errors.
      */
     public ReadAll<ParameterT, OutputT> withFetchSize(int fetchSize) {
-      checkArgument(fetchSize > 0, "fetch size must be >0");
+      // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values greater than >= 0 and that MySQL supports using Integer.MIN_VALUE as a 
hint to stream the ResultSet instead of loading it into memory. See 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
+      checkArgument(
+          fetchSize > 0 || fetchSize == Integer.MIN_VALUE,
+          "fetch size must be > 0 or equal to Integer.MIN_VALUE");

Review Comment:
   ```suggestion
         // Note that api.java.sql.Statement#setFetchSize says it only accepts 
values >= 0
         // and that MySQL supports using Integer.MIN_VALUE as a hint to stream 
the ResultSet instead
         // of loading it into memory. See
         // 
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-implementation-notes.html
 for additional details.
          checkArgument(
             fetchSize >= 0 || fetchSize == Integer.MIN_VALUE,
             "fetch size must be >= 0 or equal to Integer.MIN_VALUE");
   ```



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

Reply via email to