本文整理汇总了Java中org.apache.calcite.sql.type.OperandTypes类的典型用法代码示例。如果您正苦于以下问题:Java OperandTypes类的具体用法?Java OperandTypes怎么用?Java OperandTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperandTypes类属于org.apache.calcite.sql.type包,在下文中一共展示了OperandTypes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SqlDatePartOperator
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlDatePartOperator() {
super(
"DATE_PART",
SqlKind.OTHER_FUNCTION,
ReturnTypes.BIGINT_NULLABLE,
null,
OperandTypes.sequence(
"<PERIOD LITERAL>, <DATE or TIMESTAMP or INTERVAL>",
new EnumeratedListChecker(VALID_PERIODS.keySet()),
OperandTypes.or(
OperandTypes.family(SqlTypeFamily.DATE),
OperandTypes.family(SqlTypeFamily.TIMESTAMP),
OperandTypes.family(SqlTypeFamily.DATETIME),
OperandTypes.family(SqlTypeFamily.DATETIME_INTERVAL),
OperandTypes.family(SqlTypeFamily.INTERVAL_DAY_TIME),
OperandTypes.family(SqlTypeFamily.INTERVAL_YEAR_MONTH))
),
SqlFunctionCategory.SYSTEM);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:SqlDatePartOperator.java
示例2: apply
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
@Override
public RexNode apply(RexBuilderContext context) {
RelOptCluster cluster = context.getCluster();
RelDataTypeFactory typeFactory = cluster.getTypeFactory();
final SqlFunction UDF =
new SqlUserDefinedFunction(
new SqlIdentifier("RESOLVE_SIMPLE", SqlParserPos.ZERO),
ReturnTypes.explicit(typeFactory.createJavaType(Object.class)),
null,
OperandTypes.ANY_ANY,
ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false),
typeFactory.createJavaType(int.class)),
ScalarFunctionImpl.create(IObjectMethods.class, "resolveSimpleValue"));
RexBuilder b = context.getBuilder();
RexNode rexNode = b.makeCall(UDF, context.getIObject(), b.makeLiteral(name));
return b.makeCast(dataType, rexNode);
}
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:18,代码来源:ClassRowTypeCache.java
示例3: getSnapshot
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
@Override
public RexNode getSnapshot() {
if (snapshot == null) {
RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
RexBuilder b = getBuilder();
final SqlFunction UDF =
new SqlUserDefinedFunction(
new SqlIdentifier("GET_SNAPSHOT", SqlParserPos.ZERO),
ReturnTypes.explicit(typeFactory.createTypeWithNullability(typeFactory.createJavaType(ISnapshot.class), false)),
null,
OperandTypes.NUMERIC,
ImmutableList.of(typeFactory.createJavaType(Integer.class)),
ScalarFunctionImpl.create(SnapshotHolder.class, "get"));
snapshot = b.makeCall(UDF, b.makeLiteral(snapshotId, typeFactory.createSqlType(SqlTypeName.INTEGER), false));
}
return snapshot;
}
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:18,代码来源:ExecutionRexBuilderContext.java
示例4: getIObject
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public RexNode getIObject() {
if (object == null) {
RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
RexBuilder b = getBuilder();
final SqlFunction GET_IOBJECT =
new SqlUserDefinedFunction(
new SqlIdentifier("GET_IOBJECT", SqlParserPos.ZERO),
ReturnTypes.explicit(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false)),
null,
OperandTypes.ANY_ANY,
ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(ISnapshot.class), false),
typeFactory.createJavaType(int.class)),
ScalarFunctionImpl.create(ISnapshotMethods.class, "getIObject"));
object = b.makeCall(GET_IOBJECT, getSnapshot(), getIObjectId());
}
return object;
}
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:18,代码来源:RexBuilderContext.java
示例5: SqlMinMaxAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
/** Creates a SqlMinMaxAggFunction. */
public SqlMinMaxAggFunction(SqlKind kind) {
super(kind.name(),
null,
kind,
ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
null,
OperandTypes.COMPARABLE_ORDERED,
SqlFunctionCategory.SYSTEM,
false,
false);
this.argTypes = ImmutableList.of();
this.minMaxKind = MINMAX_COMPARABLE;
Preconditions.checkArgument(kind == SqlKind.MIN
|| kind == SqlKind.MAX);
}
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:SqlMinMaxAggFunction.java
示例6: SqlLikeOperator
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
/**
* Creates a SqlLikeOperator.
*
* @param name Operator name
* @param kind Kind
* @param negated Whether this is 'NOT LIKE'
*/
SqlLikeOperator(
String name,
SqlKind kind,
boolean negated) {
// LIKE is right-associative, because that makes it easier to capture
// dangling ESCAPE clauses: "a like b like c escape d" becomes
// "a like (b like c escape d)".
super(
name,
kind,
32,
false,
ReturnTypes.BOOLEAN_NULLABLE,
InferTypes.FIRST_KNOWN,
OperandTypes.STRING_SAME_SAME_SAME);
this.negated = negated;
}
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:SqlLikeOperator.java
示例7: checkOperandTypes
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public boolean checkOperandTypes(
SqlCallBinding callBinding,
boolean throwOnFailure) {
// check that the two operands are of same type.
switch (callBinding.getOperandCount()) {
case 2:
return OperandTypes.SAME_SAME.checkOperandTypes(
callBinding, throwOnFailure)
&& super.checkOperandTypes(callBinding, throwOnFailure);
case 3:
return OperandTypes.SAME_SAME_INTEGER.checkOperandTypes(
callBinding, throwOnFailure)
&& super.checkOperandTypes(callBinding, throwOnFailure);
default:
throw new AssertionError();
}
}
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:SqlPositionFunction.java
示例8: SqlCovarAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
/**
* Creates a SqlCovarAggFunction.
*/
public SqlCovarAggFunction(SqlKind kind) {
super(kind.name(),
null,
kind,
ReturnTypes.COVAR_FUNCTION,
null,
OperandTypes.NUMERIC_NUMERIC,
SqlFunctionCategory.NUMERIC,
false,
false);
Preconditions.checkArgument(kind == SqlKind.COVAR_POP
|| kind == SqlKind.COVAR_SAMP
|| kind == SqlKind.REGR_SXX
|| kind == SqlKind.REGR_SYY);
}
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:SqlCovarAggFunction.java
示例9: getChecker
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
private SqlSingleOperandTypeChecker getChecker(RelDataType operandType) {
switch (operandType.getSqlTypeName()) {
case ARRAY:
return OperandTypes.family(SqlTypeFamily.INTEGER);
case MAP:
return OperandTypes.family(
operandType.getKeyType().getSqlTypeName().getFamily());
case ANY:
case DYNAMIC_STAR:
return OperandTypes.or(
OperandTypes.family(SqlTypeFamily.INTEGER),
OperandTypes.family(SqlTypeFamily.CHARACTER));
default:
throw new AssertionError(operandType.getSqlTypeName());
}
}
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:SqlItemOperator.java
示例10: SqlSumCountAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlSumCountAggFunction(RelDataType type) {
super("$SUM0",
SqlKind.OTHER_FUNCTION,
ReturnTypes.BIGINT, // use the inferred return type of SqlCountAggFunction
null,
OperandTypes.NUMERIC,
SqlFunctionCategory.NUMERIC);
this.type = type;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:AggPrelBase.java
示例11: SqlHllAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlHllAggFunction() {
super("HLL",
null,
SqlKind.OTHER_FUNCTION,
ReturnTypes.explicit(SqlTypeName.BINARY),
null,
OperandTypes.ANY,
SqlFunctionCategory.USER_DEFINED_FUNCTION,
false,
false
);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:AggPrelBase.java
示例12: SqlHllMergeAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlHllMergeAggFunction() {
super("NDV_MERGE",
null,
SqlKind.OTHER_FUNCTION,
ReturnTypes.BIGINT_FORCE_NULLABLE,
null,
OperandTypes.BINARY,
SqlFunctionCategory.USER_DEFINED_FUNCTION,
false,
false
);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:AggPrelBase.java
示例13: SqlTimestampAddFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
/** Creates a SqlTimestampAddFunction. */
SqlTimestampAddFunction() {
super("TIMESTAMPADD", SqlKind.TIMESTAMP_ADD, RETURN_TYPE_INFERENCE, null,
OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
SqlTypeFamily.TIMESTAMP),
SqlFunctionCategory.TIMEDATE);
}
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:SqlTimestampAddFunction.java
示例14: createCustomAggFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
SqlAggFunction createCustomAggFunction(String funcName, RelDataType returnType, Class<?> customAggFuncClz) {
RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
SqlIdentifier sqlIdentifier = new SqlIdentifier(funcName, new SqlParserPos(1, 1));
AggregateFunction aggFunction = AggregateFunctionImpl.create(customAggFuncClz);
List<RelDataType> argTypes = new ArrayList<RelDataType>();
List<SqlTypeFamily> typeFamilies = new ArrayList<SqlTypeFamily>();
for (FunctionParameter o : aggFunction.getParameters()) {
final RelDataType type = o.getType(typeFactory);
argTypes.add(type);
typeFamilies.add(Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
}
return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType),
InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction, false, false);
}
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:OLAPAggregateRel.java
示例15: SqlSetOperator
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlSetOperator(
String name,
SqlKind kind,
int prec,
boolean all) {
super(
name,
kind,
prec,
true,
ReturnTypes.LEAST_RESTRICTIVE,
null,
OperandTypes.SET_OP);
this.all = all;
}
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:SqlSetOperator.java
示例16: SqlAsOperator
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
/**
* Creates an AS operator.
*/
public SqlAsOperator() {
this(
"AS",
SqlKind.AS,
20,
true,
ReturnTypes.ARG0,
InferTypes.RETURN_TYPE,
OperandTypes.ANY_ANY);
}
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:SqlAsOperator.java
示例17: SqlJdbcFunctionCall
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlJdbcFunctionCall(String name) {
super(
"{fn " + name + "}",
SqlKind.JDBC_FN,
null,
null,
OperandTypes.VARIADIC,
SqlFunctionCategory.SYSTEM);
jdbcName = name;
lookupMakeCallObj = JdbcToInternalLookupTable.INSTANCE.lookup(name);
lookupCall = null;
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlJdbcFunctionCall.java
示例18: SqlUnnestOperator
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlUnnestOperator(boolean withOrdinality) {
super(
"UNNEST",
SqlKind.UNNEST,
200,
true,
null,
null,
OperandTypes.repeat(SqlOperandCountRanges.from(1),
OperandTypes.SCALAR_OR_RECORD_COLLECTION_OR_MAP));
this.withOrdinality = withOrdinality;
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlUnnestOperator.java
示例19: checkOperandTypes
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public boolean checkOperandTypes(
SqlCallBinding callBinding,
boolean throwOnFailure) {
if (!OperandTypes.MULTISET.checkSingleOperandType(
callBinding,
callBinding.operand(1),
0,
throwOnFailure)) {
return false;
}
MultisetSqlType mt =
(MultisetSqlType) callBinding.getValidator().deriveType(
callBinding.getScope(),
callBinding.operand(1));
RelDataType t0 =
callBinding.getValidator().deriveType(
callBinding.getScope(),
callBinding.operand(0));
RelDataType t1 = mt.getComponentType();
if (t0.getFamily() != t1.getFamily()) {
if (throwOnFailure) {
throw callBinding.newValidationError(
RESOURCE.typeNotComparableNear(t0.toString(), t1.toString()));
}
return false;
}
return true;
}
开发者ID:apache,项目名称:calcite,代码行数:32,代码来源:SqlMultisetMemberOfOperator.java
示例20: SqlCurrentDateFunction
import org.apache.calcite.sql.type.OperandTypes; //导入依赖的package包/类
public SqlCurrentDateFunction() {
super(
"CURRENT_DATE",
SqlKind.OTHER_FUNCTION,
ReturnTypes.DATE,
null,
OperandTypes.NILADIC,
SqlFunctionCategory.TIMEDATE);
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:SqlCurrentDateFunction.java
注:本文中的org.apache.calcite.sql.type.OperandTypes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论