@Override public SqlNameMatcher nameMatcher() { return SqlNameMatchers.withCaseSensitive(false); }
final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); parentScope.resolveTable(names, liberalMatcher,
final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); parentScope.resolveTable(names, liberalMatcher,
public CalciteCatalogReader(CalciteSchema rootSchema, List<String> defaultSchema, RelDataTypeFactory typeFactory, CalciteConnectionConfig config) { this(rootSchema, SqlNameMatchers.withCaseSensitive(config != null && config.caseSensitive()), ImmutableList.of(Objects.requireNonNull(defaultSchema), ImmutableList.of()), typeFactory, config); }
case 0: if (nameMatcher.isCaseSensitive()) { final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); final Map<String, ScopeChild> map2 = findQualifyingTableNames(columnName, identifier, liberalMatcher); final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); resolve(prefix.names, liberalMatcher, false, resolved); SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); resolveInNamespace(fromNs, false, suffix.names, liberalMatcher,
public CalciteCatalogReader(CalciteSchema rootSchema, List<String> defaultSchema, RelDataTypeFactory typeFactory, CalciteConnectionConfig config) { this(rootSchema, SqlNameMatchers.withCaseSensitive(config != null && config.caseSensitive()), ImmutableList.of(Objects.requireNonNull(defaultSchema), ImmutableList.of()), typeFactory, config); }
case 0: if (nameMatcher.isCaseSensitive()) { final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); final Map<String, ScopeChild> map2 = findQualifyingTableNames(columnName, identifier, liberalMatcher); final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); resolve(prefix.names, liberalMatcher, false, resolved); SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); resolveInNamespace(fromNs, false, suffix.names, liberalMatcher,
@Override public SqlNameMatcher nameMatcher() { return SqlNameMatchers.withCaseSensitive(caseSensitive); }
public FlinkCalciteCatalogReader( CalciteSchema rootSchema, List<List<String>> defaultSchemas, RelDataTypeFactory typeFactory, CalciteConnectionConfig config) { this( rootSchema, SqlNameMatchers.withCaseSensitive(config != null && config.caseSensitive()), getDefaultSchemas(defaultSchemas), typeFactory, config); }
/** * Creates a MockCatalogReader. * <p> * <p>Caller must then call {@link #init} to populate with data.</p> * * @param typeFactory Type factory */ public MockCatalogReader(RelDataTypeFactory typeFactory, boolean caseSensitive) { super(CalciteSchema.createRootSchema(false, false, DEFAULT_CATALOG), SqlNameMatchers.withCaseSensitive(caseSensitive), ImmutableList.of(PREFIX, ImmutableList.of()), typeFactory, null); }
/** * Creates a MockCatalogReader. * * <p>Caller must then call {@link #init} to populate with data.</p> * * @param typeFactory Type factory */ public MockCatalogReader(RelDataTypeFactory typeFactory, boolean caseSensitive) { super(CalciteSchema.createRootSchema(false, false, DEFAULT_CATALOG), SqlNameMatchers.withCaseSensitive(caseSensitive), ImmutableList.of(PREFIX, ImmutableList.of()), typeFactory, null); }
private void registerTable(final List<String> names, final Table table) { assert names.get(0).equals(DEFAULT_CATALOG); final List<String> schemaPath = Util.skipLast(names); final String tableName = Util.last(names); final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, SqlNameMatchers.withCaseSensitive(true)); schema.add(tableName, table); }
protected void registerType(final List<String> names, final RelProtoDataType relProtoDataType) { assert names.get(0).equals(DEFAULT_CATALOG); final List<String> schemaPath = Util.skipLast(names); final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, SqlNameMatchers.withCaseSensitive(true)); schema.add(Util.last(names), relProtoDataType); }
private void registerTable(final List<String> names, final Table table) { assert names.get(0).equals(DEFAULT_CATALOG); final List<String> schemaPath = Util.skipLast(names); final String tableName = Util.last(names); final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, SqlNameMatchers.withCaseSensitive(true)); schema.add(tableName, table); }
protected void registerType(final List<String> names, final RelProtoDataType relProtoDataType) { assert names.get(0).equals(DEFAULT_CATALOG); final List<String> schemaPath = Util.skipLast(names); final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, SqlNameMatchers.withCaseSensitive(true)); schema.add(Util.last(names), relProtoDataType); }
@Test public void testNameMatcher() { final ImmutableList<String> beatles = ImmutableList.of("john", "paul", "ringo", "rinGo"); final SqlNameMatcher insensitiveMatcher = SqlNameMatchers.withCaseSensitive(false); assertThat(insensitiveMatcher.frequency(beatles, "ringo"), is(2)); assertThat(insensitiveMatcher.frequency(beatles, "rinGo"), is(2)); final SqlNameMatcher sensitiveMatcher = SqlNameMatchers.withCaseSensitive(true); assertThat(sensitiveMatcher.frequency(beatles, "ringo"), is(1)); assertThat(sensitiveMatcher.frequency(beatles, "rinGo"), is(1)); assertThat(sensitiveMatcher.frequency(beatles, "Ringo"), is(0)); } }
@Test public void testNameMatcher() { final ImmutableList<String> beatles = ImmutableList.of("john", "paul", "ringo", "rinGo"); final SqlNameMatcher insensitiveMatcher = SqlNameMatchers.withCaseSensitive(false); assertThat(insensitiveMatcher.frequency(beatles, "ringo"), is(2)); assertThat(insensitiveMatcher.frequency(beatles, "rinGo"), is(2)); final SqlNameMatcher sensitiveMatcher = SqlNameMatchers.withCaseSensitive(true); assertThat(sensitiveMatcher.frequency(beatles, "ringo"), is(1)); assertThat(sensitiveMatcher.frequency(beatles, "rinGo"), is(1)); assertThat(sensitiveMatcher.frequency(beatles, "Ringo"), is(0)); } }
/** * Finds a {@link org.apache.calcite.jdbc.CalciteSchema.TypeEntry} in a * given schema whose type has the given name, possibly qualified. * * @param rootSchema root schema * @param typeName name of the type, may be qualified or fully-qualified * * @return TypeEntry with a table with the given name, or null */ public static CalciteSchema.TypeEntry getTypeEntry( CalciteSchema rootSchema, SqlIdentifier typeName) { final String name; final List<String> path; if (typeName.isSimple()) { path = ImmutableList.of(); name = typeName.getSimple(); } else { path = Util.skipLast(typeName.names); name = Util.last(typeName.names); } CalciteSchema schema = rootSchema; for (String p : path) { if (schema == rootSchema && SqlNameMatchers.withCaseSensitive(true).matches(p, schema.getName())) { continue; } schema = schema.getSubSchema(p, true); } return schema == null ? null : schema.getType(name, false); }
/** * Finds a {@link org.apache.calcite.jdbc.CalciteSchema.TypeEntry} in a * given schema whose type has the given name, possibly qualified. * * @param rootSchema root schema * @param typeName name of the type, may be qualified or fully-qualified * * @return TypeEntry with a table with the given name, or null */ public static CalciteSchema.TypeEntry getTypeEntry( CalciteSchema rootSchema, SqlIdentifier typeName) { final String name; final List<String> path; if (typeName.isSimple()) { path = ImmutableList.of(); name = typeName.getSimple(); } else { path = Util.skipLast(typeName.names); name = Util.last(typeName.names); } CalciteSchema schema = rootSchema; for (String p : path) { if (schema == rootSchema && SqlNameMatchers.withCaseSensitive(true).matches(p, schema.getName())) { continue; } schema = schema.getSubSchema(p, true); } return schema == null ? null : schema.getType(name, false); }