本文整理汇总了Java中org.apache.calcite.sql.fun.SqlRowOperator类的典型用法代码示例。如果您正苦于以下问题:Java SqlRowOperator类的具体用法?Java SqlRowOperator怎么用?Java SqlRowOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlRowOperator类属于org.apache.calcite.sql.fun包,在下文中一共展示了SqlRowOperator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertRow
import org.apache.calcite.sql.fun.SqlRowOperator; //导入依赖的package包/类
/**
* Converts a ROW.
*
* <p>Called automatically via reflection.
*/
public RexNode convertRow(
SqlRexContext cx,
SqlRowOperator op,
SqlCall call) {
if (cx.getValidator().getValidatedNodeType(call).getSqlTypeName()
!= SqlTypeName.COLUMN_LIST) {
return convertCall(cx, call);
}
final RexBuilder rexBuilder = cx.getRexBuilder();
final List<RexNode> columns = new ArrayList<>();
for (SqlNode operand : call.getOperandList()) {
columns.add(
rexBuilder.makeLiteral(
((SqlIdentifier) operand).getSimple()));
}
final RelDataType type =
rexBuilder.deriveReturnType(SqlStdOperatorTable.COLUMN_LIST, columns);
return rexBuilder.makeCall(type, SqlStdOperatorTable.COLUMN_LIST, columns);
}
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:StandardConvertletTable.java
示例2: analyzeCall
import org.apache.calcite.sql.fun.SqlRowOperator; //导入依赖的package包/类
private void analyzeCall(RexCall call, Constancy callConstancy) {
parentCallTypeStack.push(call.getOperator());
// visit operands, pushing their states onto stack
super.visitCall(call);
// look for NON_CONSTANT operands
int operandCount = call.getOperands().size();
List<Constancy> operandStack = Util.last(stack, operandCount);
for (Constancy operandConstancy : operandStack) {
if (operandConstancy == Constancy.NON_CONSTANT) {
callConstancy = Constancy.NON_CONSTANT;
}
}
// Even if all operands are constant, the call itself may
// be non-deterministic.
if (!call.getOperator().isDeterministic()) {
callConstancy = Constancy.NON_CONSTANT;
} else if (call.getOperator().isDynamicFunction()) {
// We can reduce the call to a constant, but we can't
// cache the plan if the function is dynamic.
// For now, treat it same as non-deterministic.
callConstancy = Constancy.NON_CONSTANT;
}
// Row operator itself can't be reduced to a literal, but if
// the operands are constants, we still want to reduce those
if ((callConstancy == Constancy.REDUCIBLE_CONSTANT)
&& (call.getOperator() instanceof SqlRowOperator)) {
callConstancy = Constancy.NON_CONSTANT;
}
if (callConstancy == Constancy.NON_CONSTANT) {
// any REDUCIBLE_CONSTANT children are now known to be maximal
// reducible subtrees, so they can be added to the result
// list
for (int iOperand = 0; iOperand < operandCount; ++iOperand) {
Constancy constancy = operandStack.get(iOperand);
if (constancy == Constancy.REDUCIBLE_CONSTANT) {
addResult(call.getOperands().get(iOperand));
}
}
// if this cast expression can't be reduced to a literal,
// then see if we can remove the cast
if (call.getOperator() == SqlStdOperatorTable.CAST) {
reduceCasts(call);
}
}
// pop operands off of the stack
operandStack.clear();
// pop this parent call operator off the stack
parentCallTypeStack.pop();
// push constancy result for this call onto stack
stack.add(callConstancy);
}
开发者ID:apache,项目名称:calcite,代码行数:61,代码来源:ReduceExpressionsRule.java
注:本文中的org.apache.calcite.sql.fun.SqlRowOperator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论