• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SqlRowOperator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PointOutsideCoverageException类代码示例发布时间:2022-05-23
下一篇:
Java TextDocumentItem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap