@@ -422,7 +422,7 @@ public Operator visitProject(ProjectNode node, C context) {
422422 context );
423423 }
424424
425- private List <TSDataType > getInputColumnTypes (PlanNode node , ITableTypeProvider typeProvider ) {
425+ protected List <TSDataType > getInputColumnTypes (PlanNode node , ITableTypeProvider typeProvider ) {
426426 // ignore "time" column
427427 return node .getChildren ().stream ()
428428 .map (PlanNode ::getOutputSymbols )
@@ -1304,7 +1304,7 @@ public Operator visitAggregation(AggregationNode node, C context) {
13041304 return planGroupByAggregation (node , child , context .getTableTypeProvider (), context );
13051305 }
13061306
1307- private Operator planGlobalAggregation (
1307+ protected AggregationOperator planGlobalAggregation (
13081308 AggregationNode node , Operator child , ITableTypeProvider typeProvider , C context ) {
13091309 CommonOperatorContext operatorContext =
13101310 addOperatorContext (
@@ -1328,7 +1328,7 @@ private Operator planGlobalAggregation(
13281328 false ,
13291329 null ,
13301330 Collections .emptySet ())));
1331- return new AggregationOperator (operatorContext , child , aggregatorBuilder .build ());
1331+ return createAggregationOperator (operatorContext , child , aggregatorBuilder .build ());
13321332 }
13331333
13341334 // timeColumnName and measurementColumnNames will only be set for AggTableScan.
@@ -1411,7 +1411,7 @@ protected Operator planGroupByAggregation(
14111411 CommonOperatorContext operatorContext =
14121412 addOperatorContext (
14131413 context , node .getPlanNodeId (), StreamingAggregationOperator .class .getSimpleName ());
1414- return new StreamingAggregationOperator (
1414+ return createStreamingAggregationOperator (
14151415 operatorContext ,
14161416 child ,
14171417 groupByTypes ,
@@ -1457,7 +1457,7 @@ protected Operator planGroupByAggregation(
14571457 context ,
14581458 node .getPlanNodeId (),
14591459 StreamingHashAggregationOperator .class .getSimpleName ());
1460- return new StreamingHashAggregationOperator (
1460+ return createStreamingHashAggregationOperator (
14611461 operatorContext ,
14621462 child ,
14631463 preGroupedChannels ,
@@ -1484,7 +1484,7 @@ protected Operator planGroupByAggregation(
14841484 addOperatorContext (
14851485 context , node .getPlanNodeId (), HashAggregationOperator .class .getSimpleName ());
14861486
1487- return new HashAggregationOperator (
1487+ return createHashAggregationOperator (
14881488 operatorContext ,
14891489 child ,
14901490 groupByTypes ,
@@ -1497,6 +1497,89 @@ protected Operator planGroupByAggregation(
14971497 Long .MAX_VALUE );
14981498 }
14991499
1500+ protected AggregationOperator createAggregationOperator (
1501+ CommonOperatorContext operatorContext , Operator child , List <TableAggregator > aggregators ) {
1502+ return new AggregationOperator (operatorContext , child , aggregators );
1503+ }
1504+
1505+ protected StreamingAggregationOperator createStreamingAggregationOperator (
1506+ CommonOperatorContext operatorContext ,
1507+ Operator child ,
1508+ List <Type > groupByTypes ,
1509+ List <Integer > groupByChannels ,
1510+ Comparator <SortKey > groupKeyComparator ,
1511+ List <TableAggregator > aggregators ,
1512+ long maxPartialMemory ,
1513+ boolean spillEnabled ,
1514+ long unSpillMemoryLimit ) {
1515+ return new StreamingAggregationOperator (
1516+ operatorContext ,
1517+ child ,
1518+ groupByTypes ,
1519+ groupByChannels ,
1520+ groupKeyComparator ,
1521+ aggregators ,
1522+ maxPartialMemory ,
1523+ spillEnabled ,
1524+ unSpillMemoryLimit );
1525+ }
1526+
1527+ protected StreamingHashAggregationOperator createStreamingHashAggregationOperator (
1528+ CommonOperatorContext operatorContext ,
1529+ Operator child ,
1530+ List <Integer > preGroupedChannels ,
1531+ List <Integer > preGroupedIndexInResult ,
1532+ List <Type > unPreGroupedTypes ,
1533+ List <Integer > unPreGroupedChannels ,
1534+ List <Integer > unPreGroupedIndexInResult ,
1535+ Comparator <SortKey > groupKeyComparator ,
1536+ List <GroupedAggregator > aggregators ,
1537+ AggregationNode .Step step ,
1538+ int expectedGroups ,
1539+ long maxPartialMemory ,
1540+ boolean spillEnabled ,
1541+ long unSpillMemoryLimit ) {
1542+ return new StreamingHashAggregationOperator (
1543+ operatorContext ,
1544+ child ,
1545+ preGroupedChannels ,
1546+ preGroupedIndexInResult ,
1547+ unPreGroupedTypes ,
1548+ unPreGroupedChannels ,
1549+ unPreGroupedIndexInResult ,
1550+ groupKeyComparator ,
1551+ aggregators ,
1552+ step ,
1553+ expectedGroups ,
1554+ maxPartialMemory ,
1555+ spillEnabled ,
1556+ unSpillMemoryLimit );
1557+ }
1558+
1559+ protected HashAggregationOperator createHashAggregationOperator (
1560+ CommonOperatorContext operatorContext ,
1561+ Operator child ,
1562+ List <Type > groupByTypes ,
1563+ List <Integer > groupByChannels ,
1564+ List <GroupedAggregator > aggregators ,
1565+ AggregationNode .Step step ,
1566+ int expectedGroups ,
1567+ long maxPartialMemory ,
1568+ boolean spillEnabled ,
1569+ long unSpillMemoryLimit ) {
1570+ return new HashAggregationOperator (
1571+ operatorContext ,
1572+ child ,
1573+ groupByTypes ,
1574+ groupByChannels ,
1575+ aggregators ,
1576+ step ,
1577+ expectedGroups ,
1578+ maxPartialMemory ,
1579+ spillEnabled ,
1580+ unSpillMemoryLimit );
1581+ }
1582+
15001583 protected Comparator <SortKey > genGroupKeyComparator (
15011584 List <Type > groupTypes , List <Integer > groupByChannels ) {
15021585 return getComparatorForTable (
@@ -2248,8 +2331,7 @@ public Operator visitValuesNode(ValuesNode node, C context) {
22482331 public Operator visitRowNumber (RowNumberNode node , C context ) {
22492332 Operator child = node .getChild ().accept (this , context );
22502333 CommonOperatorContext operatorContext =
2251- addOperatorContext (
2252- context , node .getPlanNodeId (), MappingCollectOperator .class .getSimpleName ());
2334+ addOperatorContext (context , node .getPlanNodeId (), RowNumberOperator .class .getSimpleName ());
22532335
22542336 List <Symbol > partitionBySymbols = node .getPartitionBy ();
22552337 Map <Symbol , Integer > childLayout =
0 commit comments