scope.resolve(ImmutableList.of(name), nameMatcher, false, resolved); if (resolved.count() == 1) { ns = resolved.only().namespace;
if (resolved.count() == 1) { final SqlValidatorScope.Resolve resolve = resolved.only(); type = resolve.rowType(); for (SqlValidatorScope.Step p : Util.skip(resolve.path.steps())) {
RESOURCE.unknownIdentifier(prefixId.toString())); final RelDataType rowType = resolved.only().rowType(); if (rowType.isDynamicStruct()) {
return null; final SqlValidatorScope.Resolve resolve = resolved.only(); final RelDataType rowType = resolve.rowType();
final SqlValidatorScope.Resolve resolve = resolved.only(); final RelDataType rowType = resolve.rowType(); final int childNamespaceIndex = resolve.path.steps().get(0).i;
final SqlValidatorScope.Resolve resolve = resolved.only(); final RelDataType rowType = resolve.rowType(); final int childNamespaceIndex = resolve.path.steps().get(0).i;
false, resolved); SqlValidatorScope ancestorScope = resolved.only().scope;
false, resolved); SqlValidatorScope ancestorScope = resolved.only().scope;
false, resolved); SqlValidatorScope ancestorScope = resolved.only().scope;
false, resolved); SqlValidatorScope ancestorScope = resolved.only().scope;
/** * 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 void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }
/** * 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 void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }
private SqlValidatorNamespace getNamespace(SqlIdentifier id, DelegatingScope scope) { if (id.isSimple()) { final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolve(id.names, nameMatcher, false, resolved); if (resolved.count() == 1) { return resolved.only().namespace; } } return getNamespace(id); }
private SqlValidatorNamespace getNamespace(SqlIdentifier id, DelegatingScope scope) { if (id.isSimple()) { final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolve(id.names, nameMatcher, false, resolved); if (resolved.count() == 1) { return resolved.only().namespace; } } return getNamespace(id); }
public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }
private SqlValidatorNamespace getNamespace(SqlIdentifier id, DelegatingScope scope) { if (id.isSimple()) { final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolve(id.names, nameMatcher, false, resolved); if (resolved.count() == 1) { return resolved.only().namespace; } } return getNamespace(id); }