本文整理汇总了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());
}
示例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());
}
示例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;
}
示例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));
}
}
示例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();
}
});
}
示例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;
}
示例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;
}
示例8: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override public Void visit(SqlDynamicParam param) {
return format(param);
}
示例9: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public T visit(SqlDynamicParam param) {
throw new UnsupportedOperationException("SqlDynamicParam " + param);
}
示例10: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public List<SqlIdentifier> visit(SqlDynamicParam param) {
return Collections.emptyList();
}
示例11: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexNode visit(SqlDynamicParam param) {
return convertDynamicParam(param);
}
示例12: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override
public SqlNode visit(SqlDynamicParam param) {
return null;
}
示例13: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public RexNode visit(SqlDynamicParam param) {
return convertDynamicParam(param);
}
示例14: validateDynamicParam
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
public void validateDynamicParam(SqlDynamicParam dynamicParam) {
}
示例15: visit
import org.apache.calcite.sql.SqlDynamicParam; //导入依赖的package包/类
@Override public Void visit(SqlDynamicParam param) {
throw Util.needToImplement(param);
}