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 static CalciteSchema.TableEntry getTableEntryFrom( CalciteSchema schema, String name, boolean caseSensitive) { CalciteSchema.TableEntry entry = schema.getTable(name, caseSensitive); if (entry == null) { entry = schema.getTableBasedOnNullaryFunction(name, caseSensitive); } return entry; }
Enumerable<MetaTable> tables(final MetaSchema schema_) { final CalciteMetaSchema schema = (CalciteMetaSchema) schema_; return Linq4j.asEnumerable(schema.calciteSchema.getTableNames()) .select((Function1<String, MetaTable>) name -> { final Table table = schema.calciteSchema.getTable(name, true).getTable(); return new CalciteMetaTable(table, schema.tableCatalog, schema.tableSchem, name); }) .concat( Linq4j.asEnumerable( schema.calciteSchema.getTablesBasedOnNullaryFunctions() .entrySet()) .select(pair -> { final Table table = pair.getValue(); return new CalciteMetaTable(table, schema.tableCatalog, schema.tableSchem, pair.getKey()); })); }
schema.getTable(schemaName, nameMatcher.isCaseSensitive()); if (entry == null) { entry = schema.getTableBasedOnNullaryFunction(schemaName,
tableEntry = schema.getTable(suggestedTableName, true); if (tableEntry == null) { tableEntry = schema.getTableBasedOnNullaryFunction(suggestedTableName, true);
/** Generates a table name that is unique within the given schema. */ public static String uniqueTableName(CalciteSchema schema, String base) { String t = Objects.requireNonNull(base); for (int x = 0; schema.getTable(t, true) != null; x++) { t = base + x; } return t; }
private static CalciteSchema.TableEntry getTableEntryFrom( CalciteSchema schema, String name, boolean caseSensitive) { CalciteSchema.TableEntry entry = schema.getTable(name, caseSensitive); if (entry == null) { entry = schema.getTableBasedOnNullaryFunction(name, caseSensitive); } return entry; }
Enumerable<MetaTable> tables(final MetaSchema schema_) { final CalciteMetaSchema schema = (CalciteMetaSchema) schema_; return Linq4j.asEnumerable(schema.calciteSchema.getTableNames()) .select((Function1<String, MetaTable>) name -> { final Table table = schema.calciteSchema.getTable(name, true).getTable(); return new CalciteMetaTable(table, schema.tableCatalog, schema.tableSchem, name); }) .concat( Linq4j.asEnumerable( schema.calciteSchema.getTablesBasedOnNullaryFunctions() .entrySet()) .select(pair -> { final Table table = pair.getValue(); return new CalciteMetaTable(table, schema.tableCatalog, schema.tableSchem, pair.getKey()); })); }
tableEntry = schema.getTable(suggestedTableName, true); if (tableEntry == null) { tableEntry = schema.getTableBasedOnNullaryFunction(suggestedTableName, true);
/** Generates a table name that is unique within the given schema. */ public static String uniqueTableName(CalciteSchema schema, String base) { String t = Objects.requireNonNull(base); for (int x = 0; schema.getTable(t, true) != null; x++) { t = base + x; } return t; }
schema.getTable(schemaName, nameMatcher.isCaseSensitive()); if (entry == null) { entry = schema.getTableBasedOnNullaryFunction(schemaName,
public Table getTable(String name) { final TableEntry entry = CalciteSchema.this.getTable(name, true); return entry == null ? null : entry.getTable(); }
public Table getTable(String name) { final TableEntry entry = CalciteSchema.this.getTable(name, true); return entry == null ? null : entry.getTable(); }
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; }
.unwrap(CalciteSchema.class); assert viewSchema != null; CalciteSchema.TableEntry viewTEntry = viewSchema.getTable( view.table, false);
assertThat(a2Schema.getTableNames().size(), equalTo(4)); final CalciteSchema a2CalciteSchema = CalciteSchema.from(a2Schema); assertThat(a2CalciteSchema.getTable("table1", true), notNullValue()); assertThat(a2CalciteSchema.getTable("table1", false), notNullValue()); assertThat(a2CalciteSchema.getTable("taBle1", true), nullValue()); assertThat(a2CalciteSchema.getTable("taBle1", false), notNullValue()); final TableMacro function = ViewTable.viewMacro(a2Schema, "values 1", null, null, null);
assertThat(a2Schema.getTableNames().size(), equalTo(4)); final CalciteSchema a2CalciteSchema = CalciteSchema.from(a2Schema); assertThat(a2CalciteSchema.getTable("table1", true), notNullValue()); assertThat(a2CalciteSchema.getTable("table1", false), notNullValue()); assertThat(a2CalciteSchema.getTable("taBle1", true), nullValue()); assertThat(a2CalciteSchema.getTable("taBle1", false), notNullValue()); final TableMacro function = ViewTable.viewMacro(a2Schema, "values 1", null, null, null);
@Override public Table createTable(CalciteSchema schema, String viewSql, List<String> viewSchemaPath) { assert nzTile.tableName != null; CalciteCatalogReader calciteCatalogReader = new CalciteCatalogReader( schema.root(), false, queryContext.getDefaultSchemaPath(), queryContext.getTypeFactory()); CalciteSchema tileSchema = calciteCatalogReader.getTable(nzTile.tableName) .unwrap(CalciteSchema.class); assert tileSchema != null; CalciteSchema.TableEntry tileTEntry = tileSchema.getTable( Util.last(nzTile.tableName), false); assert tileTEntry != null; return new QuarkTileTable(nzTile, calciteCatalogReader, tileTEntry.getTable().getRowType(queryContext.getTypeFactory()), Schemas.path(rootSchema, nzTile.alias), (QuarkTable) tileTEntry.getTable()); } };
.unwrap(CalciteSchema.class); assert tileSchema != null; CalciteSchema.TableEntry tileTEntry = tileSchema.getTable( Util.last(cube.tableName), false);