kkhatua commented on a change in pull request #1714: DRILL-7048: Implement JDBC 
Statement.setMaxRows() with System Option
URL: https://github.com/apache/drill/pull/1714#discussion_r269234329
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
 ##########
 @@ -143,13 +143,18 @@ public Foreman(final WorkerBee bee, final 
DrillbitContext drillbitContext,
     this.closeFuture = initiatingClient.getChannelClosureFuture();
     closeFuture.addListener(closeListener);
 
+    // Apply AutoLimit on resultSet (Usually received via REST APIs)
+    final int autoLimit = queryRequest.getAutolimitRowcount();
+    if (autoLimit > 0) {
+      
connection.getSession().getOptions().setLocalOption(ExecConstants.QUERY_MAX_ROWS,
 autoLimit);
+    }
     this.queryContext = new QueryContext(connection.getSession(), 
drillbitContext, queryId);
     this.queryManager = new QueryManager(queryId, queryRequest, 
drillbitContext.getStoreProvider(),
         drillbitContext.getClusterCoordinator(), this);
     this.queryRM = drillbitContext.getResourceManager().newQueryRM(this);
     this.fragmentsRunner = new FragmentsRunner(bee, initiatingClient, 
drillbitContext, this);
-    this.queryStateProcessor = new QueryStateProcessor(queryIdString, 
queryManager, drillbitContext, new ForemanResult());
     this.profileOption = setProfileOption(queryContext.getOptions());
+    this.queryStateProcessor = new QueryStateProcessor(queryIdString, 
queryManager, drillbitContext, new ForemanResult());
 
 Review comment:
   Since I was originally changing the ForemanResult, I had reordered to ensure 
that the `queryContext` was set with the right values before the 
`queryStateProcessor` is initialized. I'll reorder to the original way,

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to