本文整理汇总了Java中org.apache.calcite.sql.fun.SqlSingleValueAggFunction类的典型用法代码示例。如果您正苦于以下问题:Java SqlSingleValueAggFunction类的具体用法?Java SqlSingleValueAggFunction怎么用?Java SqlSingleValueAggFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlSingleValueAggFunction类属于org.apache.calcite.sql.fun包,在下文中一共展示了SqlSingleValueAggFunction类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
@Override
public RelNode visit(LogicalAggregate aggregate) {
for(AggregateCall aggregateCall : aggregate.getAggCallList()) {
if(aggregateCall.getAggregation() instanceof SqlSingleValueAggFunction) {
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.FUNCTION,
"Non-scalar sub-query used in an expression\n" +
"See Apache Drill JIRA: DRILL-1937");
throw new UnsupportedOperationException();
}
}
return visitChild(aggregate, 0, aggregate.getInput());
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:PreProcessLogicalRel.java
示例2: visit
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
@Override
public RelNode visit(LogicalAggregate aggregate) {
for(AggregateCall aggregateCall : aggregate.getAggCallList()) {
if(aggregateCall.getAggregation() instanceof SqlSingleValueAggFunction) {
// see DRILL-1937
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.FUNCTION,
"Dremio doesn't currently support non-scalar sub-queries used in an expression");
throw new UnsupportedOperationException();
}
}
return visitChild(aggregate, 0, aggregate.getInput());
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:PreProcessRel.java
示例3: onMatch
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
LogicalAggregate singleAggregate = call.rel(0);
LogicalProject project = call.rel(1);
LogicalAggregate aggregate = call.rel(2);
// check singleAggRel is single_value agg
if ((!singleAggregate.getGroupSet().isEmpty()) || (singleAggregate.getAggCallList().size() != 1) || !(singleAggregate.getAggCallList().get(0).getAggregation() instanceof SqlSingleValueAggFunction)) {
return;
}
// check projRel only projects one expression
// check this project only projects one expression, i.e. scalar
// subqueries.
List<RexNode> projExprs = project.getProjects();
if (projExprs.size() != 1) {
return;
}
// check the input to projRel is an aggregate on the entire input
if (!aggregate.getGroupSet().isEmpty()) {
return;
}
// singleAggRel produces a nullable type, so create the new
// projection that casts proj expr to a nullable type.
final RelOptCluster cluster = project.getCluster();
RelNode newProject = RelOptUtil.createProject(aggregate, ImmutableList.of(rexBuilder.makeCast(cluster.getTypeFactory().createTypeWithNullability(projExprs.get(0).getType(), true), projExprs.get(0))), null);
call.transformTo(newProject);
}
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:FlinkRelDecorrelator.java
示例4: visit
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
@Override
public RelNode visit(LogicalAggregate aggregate) {
for(AggregateCall aggregateCall : aggregate.getAggCallList()) {
if(aggregateCall.getAggregation() instanceof SqlSingleValueAggFunction) {
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.FUNCTION,
"Non-scalar sub-query used in an expression\n" +
"See Apache Drill JIRA: DRILL-1937");
throw new UnsupportedOperationException();
}
}
return visitChild(aggregate, 0, aggregate.getInput());
}
开发者ID:axbaretto,项目名称:drill,代码行数:13,代码来源:PreProcessLogicalRel.java
示例5: implement
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
public JdbcImplementor.Result implement(JdbcImplementor implementor) {
// "select a, b, sum(x) from ( ... ) group by a, b"
final JdbcImplementor.Result x = implementor.visitChild(0, getInput());
final JdbcImplementor.Builder builder =
x.builder(this, JdbcImplementor.Clause.GROUP_BY);
List<SqlNode> groupByList = Expressions.list();
final List<SqlNode> selectList = new ArrayList<>();
for (int group : groupSet) {
final SqlNode field = builder.getContext().field(group);
addSelect(selectList, field, getRowType());
groupByList.add(field);
}
for (AggregateCall aggCall : aggCalls) {
SqlNode aggCallSqlNode = builder.getContext().toSql(aggCall);
if (aggCall.getAggregation() instanceof SqlSingleValueAggFunction) {
aggCallSqlNode =
rewriteSingleValueExpr(aggCallSqlNode, implementor.getDialect());
}
addSelect(selectList, aggCallSqlNode, getRowType());
}
builder.setSelect(new SqlNodeList(selectList, POS));
if (!groupByList.isEmpty() || aggCalls.isEmpty()) {
// Some databases don't support "GROUP BY ()". We can omit it as long
// as there is at least one aggregate function.
builder.setGroupBy(new SqlNodeList(groupByList, POS));
}
return builder.result();
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:29,代码来源:JdbcRules.java
示例6: visitAggregate
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
public Result visitAggregate(Aggregate e) {
// "select a, b, sum(x) from ( ... ) group by a, b"
final Result x = visitChild(0, e.getInput());
final Builder builder =
x.builder(e, Clause.GROUP_BY);
List<SqlNode> groupByList = Expressions.list();
final List<SqlNode> selectList = new ArrayList<>();
for (int group : e.getGroupSet()) {
final SqlNode field = builder.context.field(group);
addSelect(selectList, field, e.getRowType());
groupByList.add(field);
}
for (AggregateCall aggCall : e.getAggCallList()) {
SqlNode aggCallSqlNode = builder.context.toSql(aggCall);
if (aggCall.getAggregation() instanceof SqlSingleValueAggFunction) {
aggCallSqlNode =
rewriteSingleValueExpr(aggCallSqlNode, dialect);
}
addSelect(selectList, aggCallSqlNode, e.getRowType());
}
builder.setSelect(new SqlNodeList(selectList, POS));
if (!groupByList.isEmpty() || e.getAggCallList().isEmpty()) {
// Some databases don't support "GROUP BY ()". We can omit it as long
// as there is at least one aggregate function.
builder.setGroupBy(new SqlNodeList(groupByList, POS));
}
return builder.result();
}
开发者ID:qubole,项目名称:quark,代码行数:29,代码来源:RelToSqlConverter.java
示例7: visit
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
/** @see #dispatch */
public Result visit(Aggregate e) {
// "select a, b, sum(x) from ( ... ) group by a, b"
final Result x = visitChild(0, e.getInput());
final Builder builder;
if (e.getInput() instanceof Project) {
builder = x.builder(e);
builder.clauses.add(Clause.GROUP_BY);
} else {
builder = x.builder(e, Clause.GROUP_BY);
}
List<SqlNode> groupByList = Expressions.list();
final List<SqlNode> selectList = new ArrayList<>();
for (int group : e.getGroupSet()) {
final SqlNode field = builder.context.field(group);
addSelect(selectList, field, e.getRowType());
groupByList.add(field);
}
for (AggregateCall aggCall : e.getAggCallList()) {
SqlNode aggCallSqlNode = builder.context.toSql(aggCall);
if (aggCall.getAggregation() instanceof SqlSingleValueAggFunction) {
aggCallSqlNode = dialect.
rewriteSingleValueExpr(aggCallSqlNode);
}
addSelect(selectList, aggCallSqlNode, e.getRowType());
}
builder.setSelect(new SqlNodeList(selectList, POS));
if (!groupByList.isEmpty() || e.getAggCallList().isEmpty()) {
// Some databases don't support "GROUP BY ()". We can omit it as long
// as there is at least one aggregate function.
builder.setGroupBy(new SqlNodeList(groupByList, POS));
}
return builder.result();
}
开发者ID:apache,项目名称:calcite,代码行数:35,代码来源:RelToSqlConverter.java
示例8: onMatch
import org.apache.calcite.sql.fun.SqlSingleValueAggFunction; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
LogicalAggregate singleAggregate = call.rel(0);
LogicalProject project = call.rel(1);
LogicalAggregate aggregate = call.rel(2);
// check singleAggRel is single_value agg
if ((!singleAggregate.getGroupSet().isEmpty())
|| (singleAggregate.getAggCallList().size() != 1)
|| !(singleAggregate.getAggCallList().get(0).getAggregation()
instanceof SqlSingleValueAggFunction)) {
return;
}
// check projRel only projects one expression
// check this project only projects one expression, i.e. scalar
// sub-queries.
List<RexNode> projExprs = project.getProjects();
if (projExprs.size() != 1) {
return;
}
// check the input to project is an aggregate on the entire input
if (!aggregate.getGroupSet().isEmpty()) {
return;
}
// singleAggRel produces a nullable type, so create the new
// projection that casts proj expr to a nullable type.
final RelOptCluster cluster = project.getCluster();
RelNode newProject =
RelOptUtil.createProject(aggregate,
ImmutableList.of(
rexBuilder.makeCast(
cluster.getTypeFactory().createTypeWithNullability(
projExprs.get(0).getType(),
true),
projExprs.get(0))),
null);
call.transformTo(newProject);
}
开发者ID:apache,项目名称:calcite,代码行数:41,代码来源:RelDecorrelator.java
注:本文中的org.apache.calcite.sql.fun.SqlSingleValueAggFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论