本文整理汇总了Java中org.apache.calcite.sql.SqlCall.accept方法的典型用法代码示例。如果您正苦于以下问题:Java SqlCall.accept方法的具体用法?Java SqlCall.accept怎么用?Java SqlCall.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.sql.SqlCall
的用法示例。
在下文中一共展示了SqlCall.accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.apache.calcite.sql.SqlCall; //导入方法依赖的package包/类
public Void visit(SqlIdentifier id) {
if (isGroupExpr(id) || id.isStar()) {
// Star may validly occur in "SELECT COUNT(*) OVER w"
return null;
}
// Is it a call to a parentheses-free function?
SqlCall call =
SqlUtil.makeCall(
validator.getOperatorTable(),
id);
if (call != null) {
return call.accept(this);
}
// Didn't find the identifier in the group-by list as is, now find
// it fully-qualified.
// TODO: It would be better if we always compared fully-qualified
// to fully-qualified.
final SqlQualified fqId = scopes.peek().fullyQualify(id);
if (isGroupExpr(fqId.identifier)) {
return null;
}
SqlNode originalExpr = validator.getOriginal(id);
final String exprString = originalExpr.toString();
throw validator.newValidationError(originalExpr,
distinct
? RESOURCE.notSelectDistinctExpr(exprString)
: RESOURCE.notGroupExpr(exprString));
}
示例2: visit
import org.apache.calcite.sql.SqlCall; //导入方法依赖的package包/类
@Override public SqlNode visit(SqlIdentifier id) {
// First check for builtin functions which don't have
// parentheses, like "LOCALTIME".
SqlCall call =
SqlUtil.makeCall(
validator.getOperatorTable(),
id);
if (call != null) {
return call.accept(this);
}
final SqlIdentifier fqId = getScope().fullyQualify(id).identifier;
SqlNode expandedExpr = fqId;
// Convert a column ref into ITEM(*, 'col_name').
// select col_name from (select * from dynTable)
// SqlIdentifier "col_name" would be resolved to a dynamic star field in dynTable's rowType.
// Expand such SqlIdentifier to ITEM operator.
if (DynamicRecordType.isDynamicStarColName(Util.last(fqId.names))
&& !DynamicRecordType.isDynamicStarColName(Util.last(id.names))) {
SqlNode[] inputs = new SqlNode[2];
inputs[0] = fqId;
inputs[1] = SqlLiteral.createCharString(
Util.last(id.names),
id.getParserPosition());
SqlBasicCall item_call = new SqlBasicCall(
SqlStdOperatorTable.ITEM,
inputs,
id.getParserPosition());
expandedExpr = item_call;
}
validator.setOriginal(expandedExpr, id);
return expandedExpr;
}
示例3: visit
import org.apache.calcite.sql.SqlCall; //导入方法依赖的package包/类
public Void visit(SqlIdentifier id) {
if (isGroupExpr(id) || id.isStar()) {
// Star may validly occur in "SELECT COUNT(*) OVER w"
return null;
}
// Is it a call to a parentheses-free function?
SqlCall call =
SqlUtil.makeCall(
validator.getOperatorTable(),
id);
if (call != null) {
return call.accept(this);
}
// Didn't find the identifier in the group-by list as is, now find
// it fully-qualified.
// TODO: It would be better if we always compared fully-qualified
// to fully-qualified.
final SqlQualified fqId = scopes.peek().fullyQualify(id);
if (isGroupExpr(fqId.identifier)) {
return null;
}
SqlNode originalExpr = validator.getOriginal(id);
final String exprString = originalExpr.toString();
throw validator.newValidationError(originalExpr,
distinct
? RESOURCE.notSelectDistinctExpr(exprString)
: RESOURCE.notGroupExpr(exprString));
}