private Table findTable(CalciteSchema schema, String tableName, boolean caseSensitive) { CalciteSchema.TableEntry entry = schema.getTable(tableName, caseSensitive); if (entry != null) { return entry.getTable(); } // Check sub schemas for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) { Table table = findTable(subSchema, tableName, caseSensitive); if (table != null) { return table; } } return null; }
public Set<String> getSubSchemaNames() { return CalciteSchema.this.getSubSchemaMap().keySet(); }
public Set<String> getSubSchemaNames() { return CalciteSchema.this.getSubSchemaMap().keySet(); }
private static void gatherLattices(CalciteSchema schema, List<CalciteSchema.LatticeEntry> list) { list.addAll(schema.getLatticeMap().values()); for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) { gatherLattices(subSchema, list); } }
private static void gatherLattices(CalciteSchema schema, List<CalciteSchema.LatticeEntry> list) { list.addAll(schema.getLatticeMap().values()); for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) { gatherLattices(subSchema, list); } }
private Table findTable(CalciteSchema schema, String tableName, boolean caseSensitive) { CalciteSchema.TableEntry entry = schema.getTable(tableName, caseSensitive); if (entry != null) { return entry.getTable(); } // Check sub schemas for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) { Table table = findTable(subSchema, tableName, caseSensitive); if (table != null) { return table; } } return null; }
private Table findTable(CalciteSchema schema, String tableName, boolean caseSensitive) { CalciteSchema.TableEntry entry = schema.getTable(tableName, caseSensitive); if (entry != null) { return entry.getTable(); } // Check sub schemas for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) { Table table = findTable(subSchema, tableName, caseSensitive); if (table != null) { return table; } } return null; }
public List<SqlMoniker> getAllSchemaObjectNames(List<String> names) { final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, names, nameMatcher); if (schema == null) { return ImmutableList.of(); } final List<SqlMoniker> result = new ArrayList<>(); // Add root schema if not anonymous if (!schema.name.equals("")) { result.add(moniker(schema, null, SqlMonikerType.SCHEMA)); } final Map<String, CalciteSchema> schemaMap = schema.getSubSchemaMap(); for (String subSchema : schemaMap.keySet()) { result.add(moniker(schema, subSchema, SqlMonikerType.SCHEMA)); } for (String table : schema.getTableNames()) { result.add(moniker(schema, table, SqlMonikerType.TABLE)); } final NavigableSet<String> functions = schema.getFunctionNames(); for (String function : functions) { // views are here as well result.add(moniker(schema, function, SqlMonikerType.FUNCTION)); } return result; }
public List<SqlMoniker> getAllSchemaObjectNames(List<String> names) { final CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, names, nameMatcher); if (schema == null) { return ImmutableList.of(); } final List<SqlMoniker> result = new ArrayList<>(); // Add root schema if not anonymous if (!schema.name.equals("")) { result.add(moniker(schema, null, SqlMonikerType.SCHEMA)); } final Map<String, CalciteSchema> schemaMap = schema.getSubSchemaMap(); for (String subSchema : schemaMap.keySet()) { result.add(moniker(schema, subSchema, SqlMonikerType.SCHEMA)); } for (String table : schema.getTableNames()) { result.add(moniker(schema, table, SqlMonikerType.TABLE)); } final NavigableSet<String> functions = schema.getFunctionNames(); for (String function : functions) { // views are here as well result.add(moniker(schema, function, SqlMonikerType.FUNCTION)); } return result; }
Enumerable<MetaCatalog> catalogs() { return Linq4j.asEnumerable( CalciteSchema.from(getConnection().getRootSchema()).getSubSchemaMap().values()) .select( new Function1<CalciteSchema, MetaCatalog>() { public MetaCatalog apply(CalciteSchema calciteSchema) { return new MetaCatalog(calciteSchema.getName()); } }); }
Enumerable<MetaSchema> schemas(final String catalog) { return Linq4j.asEnumerable( getConnection().rootSchema.getSubSchemaMap().values()) .select((Function1<CalciteSchema, MetaSchema>) calciteSchema -> new CalciteMetaSchema(calciteSchema, catalog, calciteSchema.getName())) .orderBy((Function1<MetaSchema, Comparable>) metaSchema -> (Comparable) FlatLists.of(Util.first(metaSchema.tableCatalog, ""), metaSchema.tableSchem)); }
Enumerable<MetaSchema> schemas(final String catalog) { return Linq4j.asEnumerable( getConnection().rootSchema.getSubSchemaMap().values()) .select((Function1<CalciteSchema, MetaSchema>) calciteSchema -> new CalciteMetaSchema(calciteSchema, catalog, calciteSchema.getName())) .orderBy((Function1<MetaSchema, Comparable>) metaSchema -> (Comparable) FlatLists.of(Util.first(metaSchema.tableCatalog, ""), metaSchema.tableSchem)); }
NavigableMap<String, CalciteSchema> subSchemaMap = schema.getSubSchemaMap(); Set<Map.Entry<String, CalciteSchema>> matchedSchemas = subSchemaMap.entrySet().stream() .filter(entry -> entry.getValue()
Enumerable<MetaSchema> schemas(String catalog) { final Predicate1<MetaSchema> catalogMatcher = namedMatcher(Pat.of(catalog)); return Linq4j.asEnumerable( CalciteSchema.from(getConnection().getRootSchema()).getSubSchemaMap().values()) .select( new Function1<CalciteSchema, MetaSchema>() {