本文整理了Java中org.apache.calcite.sql.SqlNode.validate()
方法的一些代码示例,展示了SqlNode.validate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SqlNode.validate()
方法的具体详情如下:
包路径:org.apache.calcite.sql.SqlNode
类名称:SqlNode
方法名:validate
[英]Validates this node.
The typical implementation of this method will make a callback to the validator appropriate to the node type and context. The validator has methods such as SqlValidator#validateLiteral for these purposes.
[中]验证此节点。
此方法的典型实现将根据节点类型和上下文对验证器进行回调。出于这些目的,验证器有一些方法,比如SqlValidator#validateLiteral。
代码示例来源:origin: apache/flink
private SqlNode validateScopedExpression(
SqlNode topNode,
SqlValidatorScope scope) {
SqlNode outermostNode = performUnconditionalRewrites(topNode, false);
cursorSet.add(outermostNode);
top = outermostNode;
TRACER.trace("After unconditional rewrite: {}", outermostNode);
if (outermostNode.isA(SqlKind.TOP_LEVEL)) {
registerQuery(scope, null, outermostNode, outermostNode, null, false);
}
outermostNode.validate(this, scope);
if (!outermostNode.isA(SqlKind.TOP_LEVEL)) {
// force type derivation so that we can provide it to the
// caller later without needing the scope
deriveType(scope, outermostNode);
}
TRACER.trace("After validation: {}", outermostNode);
return outermostNode;
}
代码示例来源:origin: apache/flink
case ROLLUP:
case CUBE:
node.validate(this, groupScope);
break;
default:
代码示例来源:origin: apache/flink
protected void validateWhereOrOn(
SqlValidatorScope scope,
SqlNode condition,
String clause) {
validateNoAggs(aggOrOverOrGroupFinder, condition, clause);
inferUnknownTypes(
booleanType,
scope,
condition);
condition.validate(this, scope);
final RelDataType type = deriveType(scope, condition);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause));
}
}
代码示例来源:origin: Qihoo360/Quicksql
case ROLLUP:
case CUBE:
node.validate(this, groupScope);
break;
default:
代码示例来源:origin: apache/flink
protected void validateHavingClause(SqlSelect select) {
// HAVING is validated in the scope after groups have been created.
// For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY
// deptno HAVING empno = 10", the reference to 'empno' in the HAVING
// clause is illegal.
SqlNode having = select.getHaving();
if (having == null) {
return;
}
final AggregatingScope havingScope =
(AggregatingScope) getSelectScope(select);
if (getConformance().isHavingAlias()) {
SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true);
if (having != newExpr) {
having = newExpr;
select.setHaving(newExpr);
}
}
havingScope.checkAggregateExpr(having, true);
inferUnknownTypes(
booleanType,
havingScope,
having);
having.validate(this, havingScope);
final RelDataType type = deriveType(havingScope, having);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(having, RESOURCE.havingMustBeBoolean());
}
}
代码示例来源:origin: apache/flink
expand.validate(this, scope);
代码示例来源:origin: apache/flink
if (orderBy != null) {
for (SqlNode node : orderBy) {
node.validate(this, scope);
SqlIdentifier identifier = null;
if (node instanceof SqlBasicCall) {
代码示例来源:origin: apache/flink
operand.validate(this, scope);
代码示例来源:origin: Qihoo360/Quicksql
public void validate(SqlValidator validator, SqlValidatorScope scope) {
for (SqlNode child : list) {
child.validate(validator, scope);
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void validate(SqlValidator validator, SqlValidatorScope scope) {
for (SqlNode child : list) {
child.validate(validator, scope);
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
Usually, this method does much the same as {@link #validate}, but a/**
* Validates this node in an expression context.
*
*
* {@link SqlIdentifier} can occur in expression and non-expression
* contexts.
*/
public void validateExpr(
SqlValidator validator,
SqlValidatorScope scope) {
validate(validator, scope);
Util.discard(validator.deriveType(scope, this));
}
代码示例来源:origin: Qihoo360/Quicksql
Usually, this method does much the same as {@link #validate}, but a/**
* Validates this node in an expression context.
*
*
* {@link SqlIdentifier} can occur in expression and non-expression
* contexts.
*/
public void validateExpr(
SqlValidator validator,
SqlValidatorScope scope) {
validate(validator, scope);
Util.discard(validator.deriveType(scope, this));
}
代码示例来源:origin: Qihoo360/Quicksql
private SqlNode validateScopedExpression(
SqlNode topNode,
SqlValidatorScope scope) {
SqlNode outermostNode = performUnconditionalRewrites(topNode, false);
cursorSet.add(outermostNode);
top = outermostNode;
TRACER.trace("After unconditional rewrite: {}", outermostNode);
if (outermostNode.isA(SqlKind.TOP_LEVEL)) {
registerQuery(scope, null, outermostNode, outermostNode, null, false);
}
outermostNode.validate(this, scope);
if (!outermostNode.isA(SqlKind.TOP_LEVEL)) {
// force type derivation so that we can provide it to the
// caller later without needing the scope
deriveType(scope, outermostNode);
}
TRACER.trace("After validation: {}", outermostNode);
return outermostNode;
}
代码示例来源:origin: org.apache.calcite/calcite-core
private SqlNode validateScopedExpression(
SqlNode topNode,
SqlValidatorScope scope) {
SqlNode outermostNode = performUnconditionalRewrites(topNode, false);
cursorSet.add(outermostNode);
top = outermostNode;
TRACER.trace("After unconditional rewrite: {}", outermostNode);
if (outermostNode.isA(SqlKind.TOP_LEVEL)) {
registerQuery(scope, null, outermostNode, outermostNode, null, false);
}
outermostNode.validate(this, scope);
if (!outermostNode.isA(SqlKind.TOP_LEVEL)) {
// force type derivation so that we can provide it to the
// caller later without needing the scope
deriveType(scope, outermostNode);
}
TRACER.trace("After validation: {}", outermostNode);
return outermostNode;
}
代码示例来源:origin: org.apache.calcite/calcite-core
protected void validateWhereOrOn(
SqlValidatorScope scope,
SqlNode condition,
String clause) {
validateNoAggs(aggOrOverOrGroupFinder, condition, clause);
inferUnknownTypes(
booleanType,
scope,
condition);
condition.validate(this, scope);
final RelDataType type = deriveType(scope, condition);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause));
}
}
代码示例来源:origin: Qihoo360/Quicksql
protected void validateWhereOrOn(
SqlValidatorScope scope,
SqlNode condition,
String clause) {
validateNoAggs(aggOrOverOrGroupFinder, condition, clause);
inferUnknownTypes(
booleanType,
scope,
condition);
condition.validate(this, scope);
final RelDataType type = deriveType(scope, condition);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause));
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
protected void validateHavingClause(SqlSelect select) {
// HAVING is validated in the scope after groups have been created.
// For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY
// deptno HAVING empno = 10", the reference to 'empno' in the HAVING
// clause is illegal.
SqlNode having = select.getHaving();
if (having == null) {
return;
}
final AggregatingScope havingScope =
(AggregatingScope) getSelectScope(select);
if (getConformance().isHavingAlias()) {
SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true);
if (having != newExpr) {
having = newExpr;
select.setHaving(newExpr);
}
}
havingScope.checkAggregateExpr(having, true);
inferUnknownTypes(
booleanType,
havingScope,
having);
having.validate(this, havingScope);
final RelDataType type = deriveType(havingScope, having);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(having, RESOURCE.havingMustBeBoolean());
}
}
代码示例来源:origin: Qihoo360/Quicksql
protected void validateHavingClause(SqlSelect select) {
// HAVING is validated in the scope after groups have been created.
// For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY
// deptno HAVING empno = 10", the reference to 'empno' in the HAVING
// clause is illegal.
SqlNode having = select.getHaving();
if (having == null) {
return;
}
final AggregatingScope havingScope =
(AggregatingScope) getSelectScope(select);
if (getConformance().isHavingAlias()) {
SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true);
if (having != newExpr) {
having = newExpr;
select.setHaving(newExpr);
}
}
havingScope.checkAggregateExpr(having, true);
inferUnknownTypes(
booleanType,
havingScope,
having);
having.validate(this, havingScope);
final RelDataType type = deriveType(havingScope, having);
if (!SqlTypeUtil.inBooleanFamily(type)) {
throw newValidationError(having, RESOURCE.havingMustBeBoolean());
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
expand.validate(this, scope);
代码示例来源:origin: Qihoo360/Quicksql
expand.validate(this, scope);