当前位置: 首页>>代码示例>>Java>>正文


Java SqlOperator.getName方法代码示例

本文整理汇总了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)));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:SqlOperatorBaseTest.java

示例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;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:14,代码来源:DrillCalciteSqlOperatorWrapper.java

示例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");
    }
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:32,代码来源:ExpressionGenerator.java

示例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;
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:SqlValidatorTest.java

示例5: toJson

import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
private String toJson(SqlOperator operator) {
  // User-defined operators are not yet handled.
  return operator.getName();
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:RelJson.java

示例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));
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:45,代码来源:SqlValidatorImpl.java


注:本文中的org.apache.calcite.sql.SqlOperator.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。