Github user jinfengni commented on a diff in the pull request:
https://github.com/apache/drill/pull/406#discussion_r55428219
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java
---
@@ -103,6 +104,10 @@ public void onMatch(RelOptRuleCall call) {
return;
}
+ if (proj != null && !ProjectRemoveRule.isTrivial(proj)) {
--- End diff --
With the patch, the following query will not use directScan.
{code}
select count(*) from cp.`tpch/nation.parquet`;
{code}
{code}
00-00 Screen : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0,
cumulative cost = {75.1 rows, 425.1 cpu, 0.0 io, 0.0 network, 0.0 memory}, id =
169
00-01 Project(EXPR$0=[$0]) : rowType = RecordType(BIGINT EXPR$0):
rowcount = 1.0, cumulative cost = {75.0 rows, 425.0 cpu, 0.0 io, 0.0 network,
0.0 memory}, id = 168
00-02 StreamAgg(group=[{}], EXPR$0=[COUNT()]) : rowType =
RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {75.0 rows, 425.0
cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 167
00-03 Project($f0=[0]) : rowType = RecordType(INTEGER $f0):
rowcount = 25.0, cumulative cost = {50.0 rows, 125.0 cpu, 0.0 io, 0.0 network,
0.0 memory}, id = 166
00-04 Scan(groupscan=[ParquetGroupScan
[entries=[ReadEntryWithPath [path=classpath:/tpch/nation.parquet]],
selectionRoot=classpath:/tpch/nation.parquet, numFiles=1,
usedMetadataFile=false, columns=[]]]) : rowType = RecordType(): rowcount =
25.0, cumulative cost = {25.0 rows, 25.0 cpu, 0.0 io, 0.0 network, 0.0 memory},
id = 165
{code}
I debug a bit. Seems Line 115 is fine. But something is worng in the code
Line 117 - 123.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---