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


Java SqlSelect.getFrom方法代码示例

本文整理汇总了Java中org.apache.calcite.sql.SqlSelect.getFrom方法的典型用法代码示例。如果您正苦于以下问题:Java SqlSelect.getFrom方法的具体用法?Java SqlSelect.getFrom怎么用?Java SqlSelect.getFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.sql.SqlSelect的用法示例。


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

示例1: visit

import org.apache.calcite.sql.SqlSelect; //导入方法依赖的package包/类
@Override
public List<SqlIdentifier> visit(SqlCall call) {
  List<SqlIdentifier> result = new ArrayList<>();
  switch (call.getKind()) {
  case SELECT:
    SqlSelect select = (SqlSelect)call;
    SqlNode from = select.getFrom();
    result.addAll(extractAncestorsFromFrom(from));
    break;
  default:
    result.addAll(visitAll(call.getOperandList()));
    break;
  }
  return result;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:AncestorsVisitor.java

示例2: extractFrom

import org.apache.calcite.sql.SqlSelect; //导入方法依赖的package包/类
private FromNode extractFrom(SqlSelect select) {
  SqlNode from = select.getFrom();
  return from.accept(new BaseSqlVisitor<FromNode>() {
    @Override
    public FromNode visit(SqlIdentifier id) {
      return new FromNode(null, id);
    }
    @Override
    public FromNode visit(SqlCall call) {
      SqlOperator operator = call.getOperator();
      switch (operator.getKind()) {
      case AS:
        ASNode as = extractAS(call);
        if (as.exp.getKind() == IDENTIFIER) {
          SqlIdentifier ref = (SqlIdentifier)as.exp;
          if (!as.alias.isSimple()) {
            throw new UnsupportedOperationException("Table aliasing not supported:\n" + SqlNodes.toTreeString(call));
          }
          return new FromNode(as.alias, ref);
        } else {
          throw new UnsupportedOperationException("Unexpected AS:\n" + SqlNodes.toTreeString(call));
        }
      default:
        throw new UnsupportedOperationException("Unexpected operator in call: " + operator.getKind() + "\n" + SqlNodes.toTreeString(call));
      }
    }
  });
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:29,代码来源:QuerySemantics.java

示例3: parseStreams

import org.apache.calcite.sql.SqlSelect; //导入方法依赖的package包/类
private List<Stream> parseStreams(SqlSelect sqlSelect) throws Exception {
    List<Stream> streams = new ArrayList<>();
    SqlNode sqlFrom = sqlSelect.getFrom();
    LOG.debug("from = {}", sqlFrom);
    if (sqlFrom instanceof SqlJoin) {
        throw new IllegalArgumentException("Sql join is not yet supported");
    } else if (sqlFrom instanceof SqlIdentifier) {
        streams.add(getStream(((SqlIdentifier) sqlFrom).getSimple()));
    }
    LOG.debug("Streams {}", streams);
    return streams;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:13,代码来源:RuleParser.java

示例4: lookupSelectHints

import org.apache.calcite.sql.SqlSelect; //导入方法依赖的package包/类
/**
 * Looks up completion hints for a syntactically correct select SQL that has
 * been parsed into an expression tree.
 *
 * @param select   the Select node of the parsed expression tree
 * @param pos      indicates the position in the sql statement we want to get
 *                 completion hints for
 * @param hintList list of {@link SqlMoniker} (sql identifiers) that can
 *                 fill in at the indicated position
 */
void lookupSelectHints(
    SqlSelect select,
    SqlParserPos pos,
    Collection<SqlMoniker> hintList) {
  IdInfo info = idPositions.get(pos.toString());
  if ((info == null) || (info.scope == null)) {
    SqlNode fromNode = select.getFrom();
    final SqlValidatorScope fromScope = getFromScope(select);
    lookupFromHints(fromNode, fromScope, pos, hintList);
  } else {
    lookupNameCompletionHints(info.scope, info.id.names,
        info.id.getParserPosition(), hintList);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:SqlValidatorImpl.java


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