本文整理汇总了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;
}
示例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));
}
}
});
}
示例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;
}
示例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);
}
}