本文整理汇总了Java中org.apache.calcite.sql.SqlOperator.isGroup方法的典型用法代码示例。如果您正苦于以下问题:Java SqlOperator.isGroup方法的具体用法?Java SqlOperator.isGroup怎么用?Java SqlOperator.isGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.sql.SqlOperator
的用法示例。
在下文中一共展示了SqlOperator.isGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertGroupToAuxiliaryCalls
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
/** Converts a call to a grouped window function to a call to its auxiliary
* window function(s). For other calls returns null.
*
* <p>For example, converts {@code TUMBLE_START(rowtime, INTERVAL '1' HOUR))}
* to {@code TUMBLE(rowtime, INTERVAL '1' HOUR))}. */
public static List<Pair<SqlNode, AuxiliaryConverter>>
convertGroupToAuxiliaryCalls(SqlCall call) {
final SqlOperator op = call.getOperator();
if (op instanceof SqlGroupFunction
&& op.isGroup()) {
ImmutableList.Builder<Pair<SqlNode, AuxiliaryConverter>> builder =
ImmutableList.builder();
for (final SqlGroupFunction f
: ((SqlGroupFunction) op).getAuxiliaryFunctions()) {
builder.add(
Pair.<SqlNode, AuxiliaryConverter>of(copy(call, f),
new AuxiliaryConverter.Impl(f)));
}
return builder.build();
}
return ImmutableList.of();
}
示例2: validateNoAggs
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
/**
* Throws an error if there is an aggregate or windowed aggregate in the
* given clause.
*
* @param aggFinder Finder for the particular kind(s) of aggregate function
* @param node Parse tree
* @param clause Name of clause: "WHERE", "GROUP BY", "ON"
*/
private void validateNoAggs(AggFinder aggFinder, SqlNode node,
String clause) {
final SqlCall agg = aggFinder.findAgg(node);
if (agg == null) {
return;
}
final SqlOperator op = agg.getOperator();
if (op == SqlStdOperatorTable.OVER) {
throw newValidationError(agg,
RESOURCE.windowedAggregateIllegalInClause(clause));
} else if (op.isGroup() || op.isGroupAuxiliary()) {
throw newValidationError(agg,
RESOURCE.groupFunctionMustAppearInGroupByClause(op.getName()));
} else {
throw newValidationError(agg,
RESOURCE.aggregateIllegalInClause(clause));
}
}
示例3: convertGroupToAuxiliaryCalls
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
/** Converts a call to a grouped window function to a call to its auxiliary
* window function(s). For other calls returns null.
*
* <p>For example, converts {@code TUMBLE_START(rowtime, INTERVAL '1' HOUR))}
* to {@code TUMBLE(rowtime, INTERVAL '1' HOUR))}. */
public static List<Pair<SqlNode, AuxiliaryConverter>> convertGroupToAuxiliaryCalls(
SqlCall call) {
final SqlOperator op = call.getOperator();
if (op instanceof SqlGroupedWindowFunction
&& op.isGroup()) {
ImmutableList.Builder<Pair<SqlNode, AuxiliaryConverter>> builder =
ImmutableList.builder();
for (final SqlGroupedWindowFunction f
: ((SqlGroupedWindowFunction) op).getAuxiliaryFunctions()) {
builder.add(
Pair.<SqlNode, AuxiliaryConverter>of(copy(call, f),
new AuxiliaryConverter.Impl(f)));
}
return builder.build();
}
return ImmutableList.of();
}
示例4: visit
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
public Void visit(SqlCall call) {
final SqlOperator operator = call.getOperator();
// If nested aggregates disallowed or found an aggregate at invalid level
if (operator.isAggregator()
&& !(operator instanceof SqlAbstractGroupFunction)
&& !operator.requiresOver()) {
if (delegate != null) {
return operator.acceptCall(delegate, call);
}
if (aggregate) {
return found(call);
}
}
if (group && operator.isGroup()) {
return found(call);
}
// User-defined function may not be resolved yet.
if (operator instanceof SqlFunction) {
final SqlFunction sqlFunction = (SqlFunction) operator;
if (sqlFunction.getFunctionType().isUserDefinedNotSpecificFunction()) {
final List<SqlOperator> list = Lists.newArrayList();
opTab.lookupOperatorOverloads(sqlFunction.getSqlIdentifier(),
sqlFunction.getFunctionType(), SqlSyntax.FUNCTION, list);
for (SqlOperator operator2 : list) {
if (operator2.isAggregator() && !operator2.requiresOver()) {
// If nested aggregates disallowed or found aggregate at invalid
// level
if (aggregate) {
found(call);
}
}
}
}
}
if (call.isA(SqlKind.QUERY)) {
// don't traverse into queries
return null;
}
if (call.getKind() == SqlKind.OVER) {
if (over) {
return found(call);
} else {
// an aggregate function over a window is not an aggregate!
return null;
}
}
return super.visit(call);
}