本文整理汇总了Java中org.apache.calcite.sql.SqlKind.AS属性的典型用法代码示例。如果您正苦于以下问题:Java SqlKind.AS属性的具体用法?Java SqlKind.AS怎么用?Java SqlKind.AS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.sql.SqlKind
的用法示例。
在下文中一共展示了SqlKind.AS属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractAS
private static ASNode extractAS(SqlCall call) {
if (call.getOperator().getKind() == SqlKind.AS) {
List<SqlNode> operandList = call.getOperandList();
if (operandList.size() == 2) {
SqlNode exp = operandList.get(0);
SqlNode colID = operandList.get(1);
if (isSimpleID(colID)) {
return new ASNode((SqlIdentifier)colID, exp);
} else {
throw new UnsupportedOperationException("Unexpected AS " + colID + "\n" + SqlNodes.toTreeString(call));
}
} else {
throw new UnsupportedOperationException("Unexpected AS operands in field: \n" + SqlNodes.toTreeString(call));
}
}
throw new UnsupportedOperationException("AS not understood: " + SqlNodes.toSQLString(call));
}
示例2: populateAliases
private static void populateAliases(SqlNode from, List<String> aliases,
String current) {
if (from instanceof SqlJoin) {
SqlJoin join = (SqlJoin) from;
populateAliases(join.getLeft(), aliases, null);
populateAliases(join.getRight(), aliases, null);
} else if (from.getKind() == SqlKind.AS) {
populateAliases(SqlUtil.stripAs(from), aliases,
SqlValidatorUtil.getAlias(from, -1));
} else {
if (current == null) {
current = SqlValidatorUtil.getAlias(from, -1);
}
aliases.add(current);
}
}
示例3: visit
@Override
public SqlNode visit(SqlCall call) {
if (call instanceof SqlSelect) {
int i = 0;
for (SqlNode operand : call.getOperandList()) {
// FROM operand
if (i == 2)
nodeStack.push(State.FROM);
else
nodeStack.push(State.NOT_FROM);
i++;
if (operand == null)
continue;
operand.accept(this);
nodeStack.pop();
}
return null;
}
SqlOperator operator = call.getOperator();
if (operator != null && operator.getKind() == SqlKind.AS) {
// AS operator will be probed only if it is in FROM clause
if (nodeStack.peek() == State.FROM)
call.operand(0).accept(this);
return null;
}
return super.visit(call);
}