@VisibleForTesting public SqlValidatorScope getEmptyScope() { return new EmptyScope(this); }
public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { final List<Resolve> imperfectResolves = new ArrayList<>(); final List<Resolve> resolves = ((ResolvedImpl) resolved).resolves; // Look in the default schema, then default catalog, then root schema. for (List<String> schemaPath : validator.catalogReader.getSchemaPaths()) { resolve_(validator.catalogReader.getRootSchema(), names, schemaPath, nameMatcher, path, resolved); for (Resolve resolve : resolves) { if (resolve.remainingNames.isEmpty()) { // There is a full match. Return it as the only match. ((ResolvedImpl) resolved).clear(); resolves.add(resolve); return; } } imperfectResolves.addAll(resolves); } // If there were no matches in the last round, restore those found in // previous rounds if (resolves.isEmpty()) { resolves.addAll(imperfectResolves); } }
public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { final List<Resolve> imperfectResolves = new ArrayList<>(); final List<Resolve> resolves = ((ResolvedImpl) resolved).resolves; // Look in the default schema, then default catalog, then root schema. for (List<String> schemaPath : validator.catalogReader.getSchemaPaths()) { resolve_(validator.catalogReader.getRootSchema(), names, schemaPath, nameMatcher, path, resolved); for (Resolve resolve : resolves) { if (resolve.remainingNames.isEmpty()) { // There is a full match. Return it as the only match. ((ResolvedImpl) resolved).clear(); resolves.add(resolve); return; } } imperfectResolves.addAll(resolves); } // If there were no matches in the last round, restore those found in // previous rounds if (resolves.isEmpty()) { resolves.addAll(imperfectResolves); } }
public SqlNode validate(SqlNode topNode) { SqlValidatorScope scope = new EmptyScope(this); scope = new CatalogScope(scope, ImmutableList.of("CATALOG")); final SqlNode topNode2 = validateScopedExpression(topNode, scope); final RelDataType type = getValidatedNodeType(topNode2); Util.discard(type); return topNode2; }
public List<SqlMoniker> lookupHints(SqlNode topNode, SqlParserPos pos) { SqlValidatorScope scope = new EmptyScope(this); SqlNode outermostNode = performUnconditionalRewrites(topNode, false); cursorSet.add(outermostNode); if (outermostNode.isA(SqlKind.TOP_LEVEL)) { registerQuery( scope, null, outermostNode, outermostNode, null, false); } final SqlValidatorNamespace ns = getNamespace(outermostNode); if (ns == null) { throw new AssertionError("Not a query: " + outermostNode); } Collection<SqlMoniker> hintList = Sets.newTreeSet(SqlMoniker.COMPARATOR); lookupSelectHints(ns, pos, hintList); return ImmutableList.copyOf(hintList); }
@VisibleForTesting public SqlValidatorScope getEmptyScope() { return new EmptyScope(this); }
@VisibleForTesting public SqlValidatorScope getEmptyScope() { return new EmptyScope(this); }
public SqlNode validate(SqlNode topNode) { SqlValidatorScope scope = new EmptyScope(this); scope = new CatalogScope(scope, ImmutableList.of("CATALOG")); final SqlNode topNode2 = validateScopedExpression(topNode, scope); final RelDataType type = getValidatedNodeType(topNode2); Util.discard(type); return topNode2; }
public SqlNode validate(SqlNode topNode) { SqlValidatorScope scope = new EmptyScope(this); scope = new CatalogScope(scope, ImmutableList.of("CATALOG")); final SqlNode topNode2 = validateScopedExpression(topNode, scope); final RelDataType type = getValidatedNodeType(topNode2); Util.discard(type); return topNode2; }
public List<SqlMoniker> lookupHints(SqlNode topNode, SqlParserPos pos) { SqlValidatorScope scope = new EmptyScope(this); SqlNode outermostNode = performUnconditionalRewrites(topNode, false); cursorSet.add(outermostNode); if (outermostNode.isA(SqlKind.TOP_LEVEL)) { registerQuery( scope, null, outermostNode, outermostNode, null, false); } final SqlValidatorNamespace ns = getNamespace(outermostNode); if (ns == null) { throw new AssertionError("Not a query: " + outermostNode); } Collection<SqlMoniker> hintList = Sets.newTreeSet(SqlMoniker.COMPARATOR); lookupSelectHints(ns, pos, hintList); return ImmutableList.copyOf(hintList); }
public List<SqlMoniker> lookupHints(SqlNode topNode, SqlParserPos pos) { SqlValidatorScope scope = new EmptyScope(this); SqlNode outermostNode = performUnconditionalRewrites(topNode, false); cursorSet.add(outermostNode); if (outermostNode.isA(SqlKind.TOP_LEVEL)) { registerQuery( scope, null, outermostNode, outermostNode, null, false); } final SqlValidatorNamespace ns = getNamespace(outermostNode); if (ns == null) { throw new AssertionError("Not a query: " + outermostNode); } Collection<SqlMoniker> hintList = Sets.newTreeSet(SqlMoniker.COMPARATOR); lookupSelectHints(ns, pos, hintList); return ImmutableList.copyOf(hintList); }