capistrant commented on a change in pull request #10880:
URL: https://github.com/apache/druid/pull/10880#discussion_r574868002



##########
File path: sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java
##########
@@ -627,17 +627,38 @@ private MetaResultSet sqlResultSet(final ConnectionHandle 
ch, final String sql)
     }
   }
 
+  /**
+   * Determine JDBC 'fetch' size (is a user hint, we don't have to honor it), 
ensuring user supplied count falls within
+   * {@link AvaticaServerConfig#minRowsPerFrame} and {@link 
AvaticaServerConfig#maxRowsPerFrame}.
+   *
+   * A value of -1 supplied as input indicates that the client has no 
preference for fetch size, and can handle
+   * unlimited results (at our discretion). Similarly, a value of -1 for 
{@link AvaticaServerConfig#maxRowsPerFrame}
+   * also indicates that there is no upper limit on fetch size on the server 
side.
+   *
+   * {@link AvaticaServerConfig#minRowsPerFrame} must be configured to a value 
greater than 0, because it will be
+   * checked against if any additional frames are required (which means one of 
the input or maximum was set to a value
+   * other than -1).
+   */
   private int getEffectiveMaxRowsPerFrame(int clientMaxRowsPerFrame)
   {
     // no configured row limit, use the client provided limit
     if (config.getMaxRowsPerFrame() < 0) {
-      return clientMaxRowsPerFrame;
+      return adjustForMinumumRowsPerFrame(clientMaxRowsPerFrame);
     }
     // client provided no row limit, use the configured row limit
     if (clientMaxRowsPerFrame < 0) {
-      return config.getMaxRowsPerFrame();
+      return adjustForMinumumRowsPerFrame(config.getMaxRowsPerFrame());
     }
-    return Math.min(clientMaxRowsPerFrame, config.getMaxRowsPerFrame());
+    return adjustForMinumumRowsPerFrame(Math.min(clientMaxRowsPerFrame, 
config.getMaxRowsPerFrame()));
+  }
+
+  /**
+   * coerce frame size to minimum number of rows per frame to the minimum of 
{@link AvaticaServerConfig#minRowsPerFrame}

Review comment:
       nit: this is a little hard to read (for me at least). 
   
   maybe, `coerce frame size to be, at minimum, {@link 
AvaticaServerConfig#minRowsPerFrame}` ?




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to