本文整理汇总了Java中org.apache.calcite.sql.SqlOperator.getName方法的典型用法代码示例。如果您正苦于以下问题:Java SqlOperator.getName方法的具体用法?Java SqlOperator.getName怎么用?Java SqlOperator.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.sql.SqlOperator
的用法示例。
在下文中一共展示了SqlOperator.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSqlOperatorOverloading
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
@Test public void testSqlOperatorOverloading() {
final SqlStdOperatorTable operatorTable = SqlStdOperatorTable.instance();
for (SqlOperator sqlOperator : operatorTable.getOperatorList()) {
String operatorName = sqlOperator.getName();
List<SqlOperator> routines = new ArrayList<>();
operatorTable.lookupOperatorOverloads(
new SqlIdentifier(operatorName, SqlParserPos.ZERO),
null,
sqlOperator.getSyntax(),
routines);
Iterator<SqlOperator> iter = routines.iterator();
while (iter.hasNext()) {
SqlOperator operator = iter.next();
if (!sqlOperator.getClass().isInstance(operator)) {
iter.remove();
}
}
assertThat(routines.size(), equalTo(1));
assertThat(sqlOperator, equalTo(routines.get(0)));
}
}
示例2: DrillCalciteSqlOperatorWrapper
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
public DrillCalciteSqlOperatorWrapper(SqlOperator operator, final String rename, final List<DrillFuncHolder> functions) {
super(
operator.getName(),
operator.getKind(),
operator.getLeftPrec(),
operator.getRightPrec(),
TypeInferenceUtils.getDrillSqlReturnTypeInference(
rename,
functions),
operator.getOperandTypeInference(),
Checker.ANY_CHECKER);
this.operator = operator;
}
示例3: visit
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
@Override
public Expression visit(SqlCall call) {
SqlOperator sqlOperator = call.getOperator();
if (sqlOperator instanceof SqlBinaryOperator) {
return visitBinaryOperator((SqlBinaryOperator) sqlOperator, call.getOperandList().get(0),
call.getOperandList().get(1));
} else if (sqlOperator instanceof SqlSpecialOperator) {
return visitSqlSpecialOperator((SqlSpecialOperator) sqlOperator, call.getOperandList());
} else if (sqlOperator instanceof SqlFunction) {
SqlFunction sqlFunction = (SqlFunction) sqlOperator;
if (sqlFunction instanceof SqlAggFunction) {
return visitAggregateFunction(sqlFunction.getName(), call.getOperandList());
} else if (sqlFunction instanceof SqlUnresolvedFunction) {
String udfName = sqlFunction.getName().toUpperCase();
if (catalogUdfs.containsKey(udfName)) {
Udf udfInfo = catalogUdfs.get(udfName);
if (udfInfo.isAggregate()) {
return visitUserDefinedAggregateFunction(udfInfo, call.getOperandList());
} else {
return visitUserDefinedFunction(udfInfo, call.getOperandList());
}
} else {
throw new UnsupportedOperationException("Unknown built-in or User defined function '" + udfName + "'");
}
} else {
return visitFunction(sqlFunction.getName(), call.getOperandList());
}
} else {
throw new UnsupportedOperationException("Operator " + sqlOperator.getName() + " is not supported");
}
}
示例4: testStandardOperatorNamesAreUpperCase
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
/** Sanity check: All built-ins are upper-case. We rely on this. */
@Test public void testStandardOperatorNamesAreUpperCase() {
for (SqlOperator op : SqlStdOperatorTable.instance().getOperatorList()) {
final String name = op.getName();
switch (op.getSyntax()) {
case SPECIAL:
case INTERNAL:
break;
default:
assertThat(name.toUpperCase(Locale.ROOT), equalTo(name));
break;
}
}
}
示例5: toJson
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
private String toJson(SqlOperator operator) {
// User-defined operators are not yet handled.
return operator.getName();
}
示例6: findAllValidFunctionNames
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
private static void findAllValidFunctionNames(
List<String> names,
SqlValidator validator,
Collection<SqlMoniker> result,
SqlParserPos pos) {
// a function name can only be 1 part
if (names.size() > 1) {
return;
}
for (SqlOperator op : validator.getOperatorTable().getOperatorList()) {
SqlIdentifier curOpId =
new SqlIdentifier(
op.getName(),
pos);
final SqlCall call =
SqlUtil.makeCall(
validator.getOperatorTable(),
curOpId);
if (call != null) {
result.add(
new SqlMonikerImpl(
op.getName(),
SqlMonikerType.FUNCTION));
} else {
if ((op.getSyntax() == SqlSyntax.FUNCTION)
|| (op.getSyntax() == SqlSyntax.PREFIX)) {
if (op.getOperandTypeChecker() != null) {
String sig = op.getAllowedSignatures();
sig = sig.replaceAll("'", "");
result.add(
new SqlMonikerImpl(
sig,
SqlMonikerType.FUNCTION));
continue;
}
result.add(
new SqlMonikerImpl(
op.getName(),
SqlMonikerType.FUNCTION));
}
}
}
}