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


Java SqlDynamicParam类代码示例

本文整理汇总了Java中org.apache.calcite.sql.SqlDynamicParam的典型用法代码示例。如果您正苦于以下问题:Java SqlDynamicParam类的具体用法?Java SqlDynamicParam怎么用?Java SqlDynamicParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SqlDynamicParam类属于org.apache.calcite.sql包,在下文中一共展示了SqlDynamicParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertDynamicParam

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexDynamicParam convertDynamicParam(
	final SqlDynamicParam dynamicParam) {
	// REVIEW jvs 8-Jan-2005:  dynamic params may be encountered out of
	// order.  Should probably cross-check with the count from the parser
	// at the end and make sure they all got filled in.  Why doesn't List
	// have a resize() method?!?  Make this a utility.
	while (dynamicParam.getIndex() >= dynamicParamSqlNodes.size()) {
		dynamicParamSqlNodes.add(null);
	}

	dynamicParamSqlNodes.set(
		dynamicParam.getIndex(),
		dynamicParam);
	return rexBuilder.makeDynamicParam(
		getDynamicParamType(dynamicParam.getIndex()),
		dynamicParam.getIndex());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:SqlToRelConverter.java

示例2: convertDynamicParam

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexDynamicParam convertDynamicParam(
    final SqlDynamicParam dynamicParam) {
  // REVIEW jvs 8-Jan-2005:  dynamic params may be encountered out of
  // order.  Should probably cross-check with the count from the parser
  // at the end and make sure they all got filled in.  Why doesn't List
  // have a resize() method?!?  Make this a utility.
  while (dynamicParam.getIndex() >= dynamicParamSqlNodes.size()) {
    dynamicParamSqlNodes.add(null);
  }

  dynamicParamSqlNodes.set(
      dynamicParam.getIndex(),
      dynamicParam);
  return rexBuilder.makeDynamicParam(
      getDynamicParamType(dynamicParam.getIndex()),
      dynamicParam.getIndex());
}
 
开发者ID:apache,项目名称:kylin,代码行数:18,代码来源:SqlToRelConverter.java

示例3: inferReturnType

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
  final RelDataTypeFactory factory = opBinding.getTypeFactory();
  final boolean isNullable = opBinding
      .getOperandType(0)
      .isNullable();

  RelDataType ret = factory.createTypeWithNullability(
      opBinding.getOperandType(1),
      isNullable);
  if (opBinding instanceof SqlCallBinding) {
    SqlCallBinding callBinding = (SqlCallBinding) opBinding;
    SqlNode operand0 = callBinding.operand(0);

    // dynamic parameters and null constants need their types assigned
    // to them using the type they are casted to.
    if(((operand0 instanceof SqlLiteral)
        && (((SqlLiteral) operand0).getValue() == null))
            || (operand0 instanceof SqlDynamicParam)) {
      callBinding.getValidator().setValidatedNodeType(
          operand0,
          ret);
    }
  }

  return ret;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:28,代码来源:TypeInferenceUtils.java

示例4: handleOffsetFetch

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
private void handleOffsetFetch(SqlNode offset, SqlNode fetch) {
  if (offset instanceof SqlDynamicParam) {
    setValidatedNodeType(offset,
        typeFactory.createSqlType(SqlTypeName.INTEGER));
  }
  if (fetch instanceof SqlDynamicParam) {
    setValidatedNodeType(fetch,
        typeFactory.createSqlType(SqlTypeName.INTEGER));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:SqlValidatorImpl.java

示例5: getParameterRowType

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RelDataType getParameterRowType(SqlNode sqlQuery) {
  // NOTE: We assume that bind variables occur in depth-first tree
  // traversal in the same order that they occurred in the SQL text.
  final List<RelDataType> types = new ArrayList<>();
  // NOTE: but parameters on fetch/offset would be counted twice
  // as they are counted in the SqlOrderBy call and the inner SqlSelect call
  final Set<SqlNode> alreadyVisited = new HashSet<>();
  sqlQuery.accept(
      new SqlShuttle() {

        @Override public SqlNode visit(SqlDynamicParam param) {
          if (alreadyVisited.add(param)) {
            RelDataType type = getValidatedNodeType(param);
            types.add(type);
          }
          return param;
        }
      });
  return typeFactory.createStructType(
      types,
      new AbstractList<String>() {
        @Override public String get(int index) {
          return "?" + index;
        }

        @Override public int size() {
          return types.size();
        }
      });
}
 
开发者ID:apache,项目名称:calcite,代码行数:31,代码来源:SqlValidatorImpl.java

示例6: getMonotonicity

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public SqlMonotonicity getMonotonicity(SqlNode expr) {
  return
      ((expr instanceof SqlLiteral)
          || (expr instanceof SqlDynamicParam)
          || (expr instanceof SqlDataTypeSpec)) ? SqlMonotonicity.CONSTANT
          : SqlMonotonicity.NOT_MONOTONIC;
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:EmptyScope.java

示例7: checkOperandTypes

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
/**
 * Makes sure that the number and types of arguments are allowable.
 * Operators (such as "ROW" and "AS") which do not check their arguments can
 * override this method.
 */
public boolean checkOperandTypes(
    SqlCallBinding callBinding,
    boolean throwOnFailure) {
  final SqlNode left = callBinding.operand(0);
  final SqlNode right = callBinding.operand(1);
  if (SqlUtil.isNullLiteral(left, false)
      || left instanceof SqlDynamicParam) {
    return true;
  }
  RelDataType validatedNodeType =
      callBinding.getValidator().getValidatedNodeType(left);
  RelDataType returnType =
      callBinding.getValidator().deriveType(callBinding.getScope(), right);
  if (!SqlTypeUtil.canCastFrom(returnType, validatedNodeType, true)) {
    if (throwOnFailure) {
      throw callBinding.newError(
          RESOURCE.cannotCastValue(validatedNodeType.toString(),
              returnType.toString()));
    }
    return false;
  }
  if (SqlTypeUtil.areCharacterSetsMismatched(
      validatedNodeType,
      returnType)) {
    if (throwOnFailure) {
      // Include full type string to indicate character
      // set mismatch.
      throw callBinding.newError(
          RESOURCE.cannotCastValue(validatedNodeType.getFullTypeString(),
              returnType.getFullTypeString()));
    }
    return false;
  }
  return true;
}
 
开发者ID:apache,项目名称:calcite,代码行数:41,代码来源:SqlCastFunction.java

示例8: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override public Void visit(SqlDynamicParam param) {
  return format(param);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:SqlNodes.java

示例9: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public T visit(SqlDynamicParam param) {
  throw new UnsupportedOperationException("SqlDynamicParam " + param);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:BaseSqlVisitor.java

示例10: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public List<SqlIdentifier> visit(SqlDynamicParam param) {
  return Collections.emptyList();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:AncestorsVisitor.java

示例11: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexNode visit(SqlDynamicParam param) {
	return convertDynamicParam(param);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:4,代码来源:SqlToRelConverter.java

示例12: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public SqlNode visit(SqlDynamicParam param) {
    return null;
}
 
开发者ID:apache,项目名称:kylin,代码行数:5,代码来源:PushDownUtil.java

示例13: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexNode visit(SqlDynamicParam param) {
  return convertDynamicParam(param);
}
 
开发者ID:apache,项目名称:kylin,代码行数:4,代码来源:SqlToRelConverter.java

示例14: validateDynamicParam

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public void validateDynamicParam(SqlDynamicParam dynamicParam) {
}
 
开发者ID:apache,项目名称:calcite,代码行数:3,代码来源:SqlValidatorImpl.java

示例15: visit

import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override public Void visit(SqlDynamicParam param) {
  throw Util.needToImplement(param);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:SqlValidatorImpl.java


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