本文整理汇总了Java中org.apache.calcite.sql.type.ReturnTypes类的典型用法代码示例。如果您正苦于以下问题:Java ReturnTypes类的具体用法?Java ReturnTypes怎么用?Java ReturnTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReturnTypes类属于org.apache.calcite.sql.type包,在下文中一共展示了ReturnTypes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SqlDatePartOperator
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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: unparseDatetimeFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
/**
* Most dialects that natively support datetime floor will use this.
* In those cases the call will look like TRUNC(datetime, 'year').
*
* @param writer SqlWriter
* @param call SqlCall
* @param funName Name of the sql function to call
* @param datetimeFirst Specify the order of the datetime & timeUnit
* arguments
*/
public static void unparseDatetimeFunction(SqlWriter writer, SqlCall call,
String funName, Boolean datetimeFirst) {
SqlFunction func = new SqlFunction(funName, SqlKind.OTHER_FUNCTION,
ReturnTypes.ARG0_NULLABLE_VARYING, null, null,
SqlFunctionCategory.STRING);
SqlCall call1;
if (datetimeFirst) {
call1 = call;
} else {
// switch order of operands
SqlNode op1 = call.operand(0);
SqlNode op2 = call.operand(1);
call1 = call.getOperator().createCall(call.getParserPosition(), op2, op1);
}
SqlUtil.unparseFunctionSyntax(func, writer, call1);
}
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:SqlFloorFunction.java
示例7: SqlLikeOperator
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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
示例8: SqlCovarAggFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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: testIsDeterministic
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
@Test public void testIsDeterministic() {
SqlOperator ndc = new SqlSpecialOperator(
"NDC",
SqlKind.OTHER_FUNCTION,
0,
false,
ReturnTypes.BOOLEAN,
null, null) {
@Override public boolean isDeterministic() {
return false;
}
};
RexNode n = rexBuilder.makeCall(ndc);
assertFalse(RexUtil.isDeterministic(n));
assertEquals(0,
RexUtil.retainDeterministic(RelOptUtil.conjunctions(n)).size());
}
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:RexProgramTest.java
示例10: SqlSumCountAggFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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: createCustomAggFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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
示例14: SqlGroupedWindowFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
@Deprecated // to be removed before 2.0
public SqlGroupedWindowFunction(String name, SqlKind kind,
SqlGroupedWindowFunction groupFunction,
SqlOperandTypeChecker operandTypeChecker) {
this(name, kind, groupFunction, ReturnTypes.ARG0, null, operandTypeChecker,
SqlFunctionCategory.SYSTEM);
}
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:SqlGroupedWindowFunction.java
示例15: SqlSetOperator
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的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.ReturnTypes; //导入依赖的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: inferReturnType
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
public RelDataType inferReturnType(
SqlOperatorBinding opBinding) {
SqlCallBinding callBinding = (SqlCallBinding) opBinding;
ExplicitOperatorBinding newOpBinding =
new ExplicitOperatorBinding(
opBinding,
collectOperandTypes(
callBinding.getValidator(),
callBinding.getScope(),
callBinding.getCall()));
return ReturnTypes.BOOLEAN_NULLABLE.inferReturnType(
newOpBinding);
}
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:SqlBetweenOperator.java
示例18: SqlMultisetMemberOfOperator
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
public SqlMultisetMemberOfOperator() {
// TODO check if precedence is correct
super(
"MEMBER OF",
SqlKind.OTHER,
30,
true,
ReturnTypes.BOOLEAN_NULLABLE,
null,
null);
}
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SqlMultisetMemberOfOperator.java
示例19: SqlCurrentDateFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
public SqlCurrentDateFunction() {
super(
"CURRENT_DATE",
SqlKind.OTHER_FUNCTION,
ReturnTypes.DATE,
null,
OperandTypes.NILADIC,
SqlFunctionCategory.TIMEDATE);
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:SqlCurrentDateFunction.java
示例20: SqlFloorFunction
import org.apache.calcite.sql.type.ReturnTypes; //导入依赖的package包/类
public SqlFloorFunction(SqlKind kind) {
super(kind.name(), kind, ReturnTypes.ARG0_OR_EXACT_NO_SCALE, null,
OperandTypes.or(OperandTypes.NUMERIC_OR_INTERVAL,
OperandTypes.sequence(
"'" + kind + "(<DATE> TO <TIME_UNIT>)'\n"
+ "'" + kind + "(<TIME> TO <TIME_UNIT>)'\n"
+ "'" + kind + "(<TIMESTAMP> TO <TIME_UNIT>)'",
OperandTypes.DATETIME,
OperandTypes.ANY)),
SqlFunctionCategory.NUMERIC);
Preconditions.checkArgument(kind == SqlKind.FLOOR || kind == SqlKind.CEIL);
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlFloorFunction.java
注:本文中的org.apache.calcite.sql.type.ReturnTypes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论