Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/889#discussion_r135292416 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java --- @@ -231,6 +236,12 @@ public static boolean isScalarSubquery(RelNode root) { return true; } } + if (!hasMoreInputs && currentRel != null) { + Double rowSize = RelMetadataQuery.instance().getMaxRowCount(currentRel); --- End diff -- You could see the usage of RelMdMaxRowCount in Calcite [1]. It has implementations for different Rels including Aggregate, sort+limit. I would recommend adding some unit tests though if you are going to make the code changes since this would be new functionality. [1] https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---