public class ConvertCountToDirectScanPrule extends Prule
This rule will convert " select count(*) as mycount from table " or " select count(not-nullable-expr) as mycount from table " into
Project(mycount) \ DirectGroupScan ( PojoRecordReader ( rowCount ))or " select count(column) as mycount from table " into
Project(mycount) \ DirectGroupScan (PojoRecordReader (columnValueCount))Rule can be applied if query contains multiple count expressions. " select count(column1), count(column2), count(*) from table "
Currently, only parquet group scan has the exact row count and column value count, obtained from parquet row group info. This will save the cost to scan the whole parquet files.
NOTE: This rule is a physical planning counterpart to a similar ConvertCountToDirectScanRule logical rule. However, while the logical rule relies on the Parquet metadata cache's Summary aggregates, this rule is applicable if the exact row count is available from the GroupScan regardless of where that stat came from. Hence, it is more general, with the trade-off that the GroupScan relies on the fully expanded list of row groups to compute the aggregate row count.
Modifier and Type | Field and Description |
---|---|
static org.apache.calcite.plan.RelOptRule |
AGG_ON_PROJ_ON_SCAN |
static org.apache.calcite.plan.RelOptRule |
AGG_ON_SCAN |
Modifier and Type | Method and Description |
---|---|
void |
onMatch(org.apache.calcite.plan.RelOptRuleCall call) |
convert, isSingleMode
any, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
Copyright © 1970 The Apache Software Foundation. All rights reserved.