/** * Creates a <code>DelegatingScope</code>. * * @param parent Parent scope */ DelegatingScope(SqlValidatorScope parent) { super(); assert parent != null; this.validator = (SqlValidatorImpl) parent.getValidator(); this.parent = parent; }
/** * Creates a <code>DelegatingScope</code>. * * @param parent Parent scope */ DelegatingScope(SqlValidatorScope parent) { super(); assert parent != null; this.validator = (SqlValidatorImpl) parent.getValidator(); this.parent = parent; }
/** Registers with the validator a {@link SqlNode} that has been created * during the Sql-to-Rel process. */ private static SqlNode reg(SqlValidatorScope scope, SqlNode e) { scope.getValidator().deriveType(scope, e); return e; }
/** Registers with the validator a {@link SqlNode} that has been created * during the Sql-to-Rel process. */ private static SqlNode reg(SqlValidatorScope scope, SqlNode e) { scope.getValidator().deriveType(scope, e); return e; }
/** Registers with the validator a {@link SqlNode} that has been created * during the Sql-to-Rel process. */ private static SqlNode reg(SqlValidatorScope scope, SqlNode e) { scope.getValidator().deriveType(scope, e); return e; }
/** Registers with the validator a {@link SqlNode} that has been created * during the Sql-to-Rel process. */ private static SqlNode reg(SqlValidatorScope scope, SqlNode e) { scope.getValidator().deriveType(scope, e); return e; }
/** * Returns whether this operator is monotonic. * * <p>Default implementation returns {@link SqlMonotonicity#NOT_MONOTONIC}. * * @param call Call to this operator * @param scope Scope in which the call occurs * * @deprecated Use {@link #getMonotonicity(SqlOperatorBinding)} */ @Deprecated // to be removed before 2.0 public SqlMonotonicity getMonotonicity( SqlCall call, SqlValidatorScope scope) { return getMonotonicity( new SqlCallBinding(scope.getValidator(), scope, call)); }
/** * Returns whether this operator is monotonic. * * <p>Default implementation returns {@link SqlMonotonicity#NOT_MONOTONIC}. * * @param call Call to this operator * @param scope Scope in which the call occurs * * @deprecated Use {@link #getMonotonicity(SqlOperatorBinding)} */ @Deprecated // to be removed before 2.0 public SqlMonotonicity getMonotonicity( SqlCall call, SqlValidatorScope scope) { return getMonotonicity( new SqlCallBinding(scope.getValidator(), scope, call)); }
public void found(SqlValidatorNamespace namespace, boolean nullable, SqlValidatorScope scope, Path path, List<String> remainingNames) { if (scope instanceof TableScope) { scope = scope.getValidator().getSelectScope((SqlSelect) scope.getNode()); } if (scope instanceof AggregatingSelectScope) { scope = ((AggregatingSelectScope) scope).parent; assert scope instanceof SelectScope; } resolves.add( new Resolve(namespace, nullable, scope, path, remainingNames)); }
public void found(SqlValidatorNamespace namespace, boolean nullable, SqlValidatorScope scope, Path path, List<String> remainingNames) { if (scope instanceof TableScope) { scope = scope.getValidator().getSelectScope((SqlSelect) scope.getNode()); } if (scope instanceof AggregatingSelectScope) { scope = ((AggregatingSelectScope) scope).parent; assert scope instanceof SelectScope; } resolves.add( new Resolve(namespace, nullable, scope, path, remainingNames)); }
/** * Creates a CollectNamespace. * * @param child Parse tree node * @param scope Scope * @param enclosingNode Enclosing parse tree node */ CollectNamespace( SqlCall child, SqlValidatorScope scope, SqlNode enclosingNode) { super((SqlValidatorImpl) scope.getValidator(), enclosingNode); this.child = child; this.scope = scope; assert child.getKind() == SqlKind.MULTISET_VALUE_CONSTRUCTOR || child.getKind() == SqlKind.MULTISET_QUERY_CONSTRUCTOR; }
/** * Creates a CollectNamespace. * * @param child Parse tree node * @param scope Scope * @param enclosingNode Enclosing parse tree node */ CollectNamespace( SqlCall child, SqlValidatorScope scope, SqlNode enclosingNode) { super((SqlValidatorImpl) scope.getValidator(), enclosingNode); this.child = child; this.scope = scope; assert child.getKind() == SqlKind.MULTISET_VALUE_CONSTRUCTOR || child.getKind() == SqlKind.MULTISET_QUERY_CONSTRUCTOR; }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // Delegate to operator. final SqlCallBinding binding = new SqlCallBinding(scope.getValidator(), scope, this); return getOperator().getMonotonicity(binding); }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // Delegate to operator. final SqlCallBinding binding = new SqlCallBinding(scope.getValidator(), scope, this); return getOperator().getMonotonicity(binding); }
public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlCall call = SqlUtil.makeCall(getScope().getValidator().getOperatorTable(), id); if (call != null) { return call; } return getScope().fullyQualify(id).identifier; }
public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlCall call = SqlUtil.makeCall(getScope().getValidator().getOperatorTable(), id); if (call != null) { return call; } return getScope().fullyQualify(id).identifier; }
/** * Resolves a multi-part identifier such as "SCHEMA.EMP.EMPNO" to a * namespace. The returned namespace, never null, may represent a * schema, table, column, etc. */ public static SqlValidatorNamespace lookup( SqlValidatorScope scope, List<String> names) { assert names.size() > 0; final SqlNameMatcher nameMatcher = scope.getValidator().getCatalogReader().nameMatcher(); final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolve(ImmutableList.of(names.get(0)), nameMatcher, false, resolved); assert resolved.count() == 1; SqlValidatorNamespace namespace = resolved.only().namespace; for (String name : Util.skip(names)) { namespace = namespace.lookupChild(name); assert namespace != null; } return namespace; }
/** * Resolves a multi-part identifier such as "SCHEMA.EMP.EMPNO" to a * namespace. The returned namespace, never null, may represent a * schema, table, column, etc. */ public static SqlValidatorNamespace lookup( SqlValidatorScope scope, List<String> names) { assert names.size() > 0; final SqlNameMatcher nameMatcher = scope.getValidator().getCatalogReader().nameMatcher(); final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolve(ImmutableList.of(names.get(0)), nameMatcher, false, resolved); assert resolved.count() == 1; SqlValidatorNamespace namespace = resolved.only().namespace; for (String name : Util.skip(names)) { namespace = namespace.lookupChild(name); assert namespace != null; } return namespace; }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // for "star" column, whether it's static or dynamic return not_monotonic directly. if (Util.last(names).equals("") || DynamicRecordType.isDynamicStarColName(Util.last(names))) { return SqlMonotonicity.NOT_MONOTONIC; } // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlValidator validator = scope.getValidator(); SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), this); if (call != null) { return call.getMonotonicity(scope); } final SqlQualified qualified = scope.fullyQualify(this); final SqlIdentifier fqId = qualified.identifier; return qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names)); } }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // for "star" column, whether it's static or dynamic return not_monotonic directly. if (Util.last(names).equals("") || DynamicRecordType.isDynamicStarColName(Util.last(names))) { return SqlMonotonicity.NOT_MONOTONIC; } // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlValidator validator = scope.getValidator(); SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), this); if (call != null) { return call.getMonotonicity(scope); } final SqlQualified qualified = scope.fullyQualify(this); final SqlIdentifier fqId = qualified.identifier; return qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names)); } }