本文整理汇总了Java中org.apache.calcite.sql.SqlKind.OTHER_FUNCTION属性的典型用法代码示例。如果您正苦于以下问题:Java SqlKind.OTHER_FUNCTION属性的具体用法?Java SqlKind.OTHER_FUNCTION怎么用?Java SqlKind.OTHER_FUNCTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.sql.SqlKind
的用法示例。
在下文中一共展示了SqlKind.OTHER_FUNCTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SqlDatePartOperator
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);
}
示例2: unparseDatetimeFunction
/**
* 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);
}
示例3: testIsDeterministic
@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());
}
示例4: SqlSumCountAggFunction
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;
}
示例5: SqlHllAggFunction
public SqlHllAggFunction() {
super("HLL",
null,
SqlKind.OTHER_FUNCTION,
ReturnTypes.explicit(SqlTypeName.BINARY),
null,
OperandTypes.ANY,
SqlFunctionCategory.USER_DEFINED_FUNCTION,
false,
false
);
}
示例6: SqlHllMergeAggFunction
public SqlHllMergeAggFunction() {
super("NDV_MERGE",
null,
SqlKind.OTHER_FUNCTION,
ReturnTypes.BIGINT_FORCE_NULLABLE,
null,
OperandTypes.BINARY,
SqlFunctionCategory.USER_DEFINED_FUNCTION,
false,
false
);
}
示例7: SqlAggOperator
public SqlAggOperator(String name, int argCountMin, int argCountMax, SqlReturnTypeInference sqlReturnTypeInference) {
super(name,
new SqlIdentifier(name, SqlParserPos.ZERO),
SqlKind.OTHER_FUNCTION,
sqlReturnTypeInference,
null,
Checker.getChecker(argCountMin, argCountMax),
SqlFunctionCategory.USER_DEFINED_FUNCTION);
}
示例8: SqlUserDefinedAggFunction
public SqlUserDefinedAggFunction(SqlIdentifier opName,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
AggregateFunction function,
Boolean requestsOver) {
super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
returnTypeInference, operandTypeInference, operandTypeChecker,
SqlFunctionCategory.USER_DEFINED_FUNCTION, false, requestsOver);
this.function = function;
}
示例9: needsFinalColumnReordering
/**
* Whether this Project requires a final column re-ordering. Returns False for all cases except when
* convert_fromjson function is present. For convert_fromjson function, the Project operator at
* run-time produces an output schema with convert_fromjson expr appended to the end of the schema.
* We need a final column re-ordering to ensure the correct column order.
*/
@Override
public boolean needsFinalColumnReordering() {
for (RexNode expr : this.exps) {
// TODO: a convert_fromjson nested within other convert functions currently does not work.
// When it is supported, we should enhance this check by using a visitor to find the nested function.
if (expr.getKind() == SqlKind.OTHER_FUNCTION &&
expr instanceof RexCall &&
((RexCall) expr).getOperator().getName().equalsIgnoreCase("CONVERT_FROMJSON")) {
return true;
}
}
return false;
}
示例10: DrillSqlAggOperator
protected DrillSqlAggOperator(String name, List<DrillFuncHolder> functions, int argCountMin, int argCountMax, SqlReturnTypeInference sqlReturnTypeInference) {
super(name,
new SqlIdentifier(name, SqlParserPos.ZERO),
SqlKind.OTHER_FUNCTION,
sqlReturnTypeInference,
null,
Checker.getChecker(argCountMin, argCountMax),
SqlFunctionCategory.USER_DEFINED_FUNCTION);
this.functions = functions;
}
示例11: SqlUserDefinedAggFunction
/** Creates a SqlUserDefinedAggFunction. */
public SqlUserDefinedAggFunction(SqlIdentifier opName,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker, AggregateFunction function,
boolean requiresOrder, boolean requiresOver, RelDataTypeFactory typeFactory) {
super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
returnTypeInference, operandTypeInference, operandTypeChecker,
SqlFunctionCategory.USER_DEFINED_FUNCTION, requiresOrder, requiresOver);
this.function = function;
this.typeFactory = typeFactory;
}
示例12: SqlUserDefinedTableMacro
public SqlUserDefinedTableMacro(SqlIdentifier opName,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker, List<RelDataType> paramTypes,
TableMacro tableMacro) {
super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
returnTypeInference, operandTypeInference, operandTypeChecker,
Preconditions.checkNotNull(paramTypes),
SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
this.tableMacro = tableMacro;
}
示例13: SqlUserDefinedFunction
/** Constructor used internally and by derived classes. */
protected SqlUserDefinedFunction(SqlIdentifier opName,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
List<RelDataType> paramTypes,
Function function,
SqlFunctionCategory category) {
super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
returnTypeInference, operandTypeInference, operandTypeChecker,
paramTypes, category);
this.function = function;
}
示例14: SqlCurrentDateFunction
public SqlCurrentDateFunction() {
super(
"CURRENT_DATE",
SqlKind.OTHER_FUNCTION,
ReturnTypes.DATE,
null,
OperandTypes.NILADIC,
SqlFunctionCategory.TIMEDATE);
}
示例15: SqlSubstringFunction
/**
* Creates the SqlSubstringFunction.
*/
SqlSubstringFunction() {
super(
"SUBSTRING",
SqlKind.OTHER_FUNCTION,
ReturnTypes.ARG0_NULLABLE_VARYING,
null,
null,
SqlFunctionCategory.STRING);
}