Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/889#discussion_r135199961 --- 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 -- Actually, I am thinking this entire method isScalarSubquery() should be rewritten to call RelMetadataQuery.getMaxRowCount(). Originally, when this was written, the max row count interface was not available. I think your use case is somewhat specific that the table has 1 row. However, suppose we had LIMIT 1 in the subquery, we could still treat it as scalar since it would produce at most 1 row. My thought is instead of solving for your specific table scan case, we might as well address the generalized scalar check since Calcite already provides it.
--- 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. ---