OmniSciDB  04ee39c94c
org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder Class Reference
+ Inheritance diagram for org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder:
+ Collaboration diagram for org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder:

Public Member Functions

Void visit (SqlCall call)
 

Package Attributes

final SqlNodeList list = new SqlNodeList(SqlParserPos.ZERO)
 
final SqlNodeList filterList = new SqlNodeList(SqlParserPos.ZERO)
 
final SqlNodeList orderList = new SqlNodeList(SqlParserPos.ZERO)
 

Detailed Description

Visitor that collects all aggregate functions in a SqlNode tree.

Definition at line 5179 of file SqlToRelConverter.java.

Member Function Documentation

◆ visit()

Void org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder.visit ( SqlCall  call)
inline

Definition at line 5185 of file SqlToRelConverter.java.

5185  {
5186  // ignore window aggregates and ranking functions (associated with OVER operator)
5187  if (call.getOperator().getKind() == SqlKind.OVER) {
5188  return null;
5189  }
5190 
5191  if (call.getOperator().getKind() == SqlKind.FILTER) {
5192  // the WHERE in a FILTER must be tracked too so we can call replaceSubQueries on
5193  // it. see https://issues.apache.org/jira/browse/CALCITE-1910
5194  final SqlNode aggCall = call.getOperandList().get(0);
5195  final SqlNode whereCall = call.getOperandList().get(1);
5196  list.add(aggCall);
5197  filterList.add(whereCall);
5198  return null;
5199  }
5200 
5201  if (call.getOperator().getKind() == SqlKind.WITHIN_GROUP) {
5202  // the WHERE in a WITHIN_GROUP must be tracked too so we can call
5203  // replaceSubQueries on it. see https://issues.apache.org/jira/browse/CALCITE-1910
5204  final SqlNode aggCall = call.getOperandList().get(0);
5205  final SqlNodeList orderList = (SqlNodeList) call.getOperandList().get(1);
5206  list.add(aggCall);
5207  orderList.getList().forEach(this.orderList::add);
5208  return null;
5209  }
5210 
5211  if (call.getOperator().isAggregator()) {
5212  list.add(call);
5213  return null;
5214  }
5215 
5216  // Don't traverse into sub-queries, even if they contain aggregate
5217  // functions.
5218  if (call instanceof SqlSelect) {
5219  return null;
5220  }
5221 
5222  return call.getOperator().acceptCall(this, call);
5223  }

Member Data Documentation

◆ filterList

final SqlNodeList org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder.filterList = new SqlNodeList(SqlParserPos.ZERO)
package

◆ list

final SqlNodeList org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder.list = new SqlNodeList(SqlParserPos.ZERO)
package

◆ orderList

final SqlNodeList org.apache.calcite.sql2rel.SqlToRelConverter.AggregateFinder.orderList = new SqlNodeList(SqlParserPos.ZERO)
package

The documentation for this class was generated from the following file: