vvysotskyi commented on a change in pull request #2092:
URL: https://github.com/apache/drill/pull/2092#discussion_r507174594
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java
##########
@@ -454,26 +454,40 @@ public boolean supportsLimitPushdown() {
return true;
}
+ public void setLimit (int limitToPushDown) {
+ this.maxRecords = limitToPushDown;
+ }
+
@Override
public GroupScan applyLimit(int maxRecords) {
- this.maxRecords = maxRecords;
- this.maxRecords = Math.max(this.maxRecords, 1); // Make sure it request at
least 1 row -> 1 file.
+ maxRecords = Math.max(maxRecords, 1); // Make sure it request at least 1
row -> 1 file.
GroupScanWithMetadataFilterer<?> prunedMetadata = getFilterer();
if (getTableMetadata() != null) {
long tableRowCount =
TableStatisticsKind.ROW_COUNT.getValue(getTableMetadata());
- if (tableRowCount == Statistic.NO_COLUMN_STATS || tableRowCount <=
this.maxRecords) {
+ if (tableRowCount == Statistic.NO_COLUMN_STATS || tableRowCount <=
maxRecords) {
logger.debug("limit push down does not apply, since total number of
rows [{}] is less or equal to the required [{}].",
tableRowCount, maxRecords);
+ // Return the group scan with the limit pushed down
+ if (this.maxRecords != maxRecords) {
+ this.setLimit(maxRecords);
Review comment:
This line modifies this instance of a group scan. Please create a new
instance using a copy constructor, set the value there, and return it.
----------------------------------------------------------------
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]