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


Java SqlSpecialOperator类代码示例

本文整理汇总了Java中org.apache.calcite.sql.SqlSpecialOperator的典型用法代码示例。如果您正苦于以下问题:Java SqlSpecialOperator类的具体用法?Java SqlSpecialOperator怎么用?Java SqlSpecialOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SqlSpecialOperator类属于org.apache.calcite.sql包,在下文中一共展示了SqlSpecialOperator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toTreeEx

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
/**
 * Converts a list of {expression, operator, expression, ...} into a tree,
 * taking operator precedence and associativity into account.
 *
 * @param list        List of operands and operators. This list is modified as
 *                    expressions are reduced.
 * @param start       Position of first operand in the list. Anything to the
 *                    left of this (besides the immediately preceding operand)
 *                    is ignored. Generally use value 1.
 * @param minPrec     Minimum precedence to consider. If the method encounters
 *                    an operator of lower precedence, it doesn't reduce any
 *                    further.
 * @param stopperKind If not {@link SqlKind#OTHER}, stop reading the list if
 *                    we encounter a token of this kind.
 * @return the root node of the tree which the list condenses into
 */
public static SqlNode toTreeEx(SqlSpecialOperator.TokenSequence list,
    int start, final int minPrec, final SqlKind stopperKind) {
  final Predicate<PrecedenceClimbingParser.Token> predicate =
      new PredicateImpl<PrecedenceClimbingParser.Token>() {
        public boolean test(PrecedenceClimbingParser.Token t) {
          if (t instanceof PrecedenceClimbingParser.Op) {
            final SqlOperator op = ((ToTreeListItem) t.o).op;
            return stopperKind != SqlKind.OTHER
                && op.kind == stopperKind
                || minPrec > 0
                && op.getLeftPrec() < minPrec;
          } else {
            return false;
          }
        }
      };
  PrecedenceClimbingParser parser = list.parser(start, predicate);
  final int beforeSize = parser.all().size();
  parser.partialParse();
  final int afterSize = parser.all().size();
  final SqlNode node = convert(parser.all().get(0));
  list.replaceSublist(start, start + beforeSize - afterSize + 1, node);
  return node;
}
 
开发者ID:apache,项目名称:calcite,代码行数:41,代码来源:SqlParserUtil.java

示例2: testIsDeterministic

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的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

示例3: visit

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的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: SqlShowViews

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlShowViews(
    SqlParserPos pos,
    SqlNode likePattern) {
  super(pos, likePattern);
  this.likePattern = likePattern;
  operator = new SqlSpecialOperator("SHOW_VIEW", SqlKind.OTHER_DDL);
  operatorString = "SHOW VIEW";
}
 
开发者ID:qubole,项目名称:quark,代码行数:9,代码来源:SqlShowViews.java

示例5: SqlAlterQuarkDataSource

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlAlterQuarkDataSource(SqlParserPos pos,
                     SqlNodeList targetColumnList,
                     SqlNodeList sourceExpressionList,
                     SqlIdentifier identifier) {
  super(pos, targetColumnList, sourceExpressionList, identifier);
  operator = new SqlSpecialOperator("ALTER_DATASOURCE", SqlKind.OTHER_DDL);
  operatorString = "ALTER DATASOURCE";
}
 
开发者ID:qubole,项目名称:quark,代码行数:9,代码来源:SqlAlterQuarkDataSource.java

示例6: SqlAlterQuarkView

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlAlterQuarkView(SqlParserPos pos,
                     SqlNodeList targetColumnList,
                     SqlNodeList sourceExpressionList,
                     SqlIdentifier identifier) {
  super(pos, targetColumnList, sourceExpressionList, identifier);
  operator = new SqlSpecialOperator("ALTER_VIEW", SqlKind.OTHER_DDL);
  operatorString = "ALTER VIEW";
}
 
开发者ID:qubole,项目名称:quark,代码行数:9,代码来源:SqlAlterQuarkView.java

示例7: SqlCreateQuarkDataSource

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlCreateQuarkDataSource(SqlParserPos pos,
                     SqlNodeList targetColumnList,
                     SqlNodeList sourceExpressionList,
                     SqlIdentifier identifier) {
  super(pos, targetColumnList, sourceExpressionList, identifier);
  operator = new SqlSpecialOperator("CREATE_DATASOURCE", SqlKind.OTHER_DDL);
  operatorString = "CREATE DATASOURCE";
}
 
开发者ID:qubole,项目名称:quark,代码行数:9,代码来源:SqlCreateQuarkDataSource.java

示例8: createPrepareFactory

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
@Override protected Function0<CalcitePrepare> createPrepareFactory() {
  return new Function0<CalcitePrepare>() {
    @Override public CalcitePrepare apply() {
      return new CalcitePrepareImpl() {
        @Override protected SqlParser.ConfigBuilder createParserConfig() {
          return super.createParserConfig().setParserFactory(
              new SqlParserImplFactory() {
                @Override public SqlAbstractParserImpl
                getParser(Reader stream) {
                  return new SqlParserImpl(stream) {
                    @Override public SqlNode parseSqlStmtEof() {
                      return new SqlCall(SqlParserPos.ZERO) {
                        @Override public SqlOperator getOperator() {
                          return new SqlSpecialOperator("COMMIT",
                              SqlKind.COMMIT);
                        }

                        @Override public List<SqlNode> getOperandList() {
                          return ImmutableList.of();
                        }
                      };
                    }
                  };
                }
              });
        }

        @Override public void executeDdl(Context context, SqlNode node) {
          ++counter;
        }
      };
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:35,代码来源:JdbcTest.java

示例9: SqlDropQuarkView

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlDropQuarkView(
    SqlParserPos pos,
    SqlIdentifier identifier) {
  super(pos, identifier);
  operator = new SqlSpecialOperator("DROP_VIEW", SqlKind.OTHER_DDL);
}
 
开发者ID:qubole,项目名称:quark,代码行数:7,代码来源:SqlDropQuarkView.java

示例10: SqlDropQuarkDataSource

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlDropQuarkDataSource(
    SqlParserPos pos,
    SqlIdentifier identifier) {
  super(pos, identifier);
  operator = new SqlSpecialOperator("DROP_DATASOURCE", SqlKind.OTHER_DDL);
}
 
开发者ID:qubole,项目名称:quark,代码行数:7,代码来源:SqlDropQuarkDataSource.java

示例11: SqlShowQuark

import org.apache.calcite.sql.SqlSpecialOperator; //导入依赖的package包/类
public SqlShowQuark(SqlParserPos pos, SqlNode likePattern) {
  super(pos);
  operator = new SqlSpecialOperator("SHOW_DATASOURCE", SqlKind.OTHER_DDL);
  this.likePattern = likePattern;
}
 
开发者ID:qubole,项目名称:quark,代码行数:6,代码来源:SqlShowQuark.java


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