当前位置: 首页>>代码示例>>Java>>正文


Java SqlOperator.isGroup方法代码示例

本文整理汇总了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();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:SqlStdOperatorTable.java

示例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));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:SqlValidatorImpl.java

示例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();
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:SqlStdOperatorTable.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:49,代码来源:AggVisitor.java


注:本文中的org.apache.calcite.sql.SqlOperator.isGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。