@Override protected Map<String, Table> getTableMap() { final Map<String, Table> map = new LinkedHashMap<>(); for (String name : sourceSchema.getTableNames()) { final Table table = sourceSchema.getTable(name); if (table instanceof QueryableTable) { final QueryableTable sourceTable = (QueryableTable) table; map.put(name, createCloneTable(MATERIALIZATION_CONNECTION, sourceTable, name)); } } return map; }
/** Returns an {@link org.apache.calcite.linq4j.Enumerable} over object * arrays, given a fully-qualified table name which leads to a * {@link ScannableTable}. */ public static Table table(DataContext root, String... names) { SchemaPlus schema = root.getRootSchema(); final List<String> nameList = Arrays.asList(names); for (Iterator<? extends String> iterator = nameList.iterator();;) { String name = iterator.next(); if (iterator.hasNext()) { schema = schema.getSubSchema(name); } else { return schema.getTable(name); } } }
@Override protected Map<String, Table> getTableMap() { final Map<String, Table> map = new LinkedHashMap<>(); for (String name : sourceSchema.getTableNames()) { final Table table = sourceSchema.getTable(name); if (table instanceof QueryableTable) { final QueryableTable sourceTable = (QueryableTable) table; map.put(name, createCloneTable(MATERIALIZATION_CONNECTION, sourceTable, name)); } } return map; }
/** Returns an {@link org.apache.calcite.linq4j.Enumerable} over object * arrays, given a fully-qualified table name which leads to a * {@link ScannableTable}. */ public static Table table(DataContext root, String... names) { SchemaPlus schema = root.getRootSchema(); final List<String> nameList = Arrays.asList(names); for (Iterator<? extends String> iterator = nameList.iterator();;) { String name = iterator.next(); if (iterator.hasNext()) { schema = schema.getSubSchema(name); } else { return schema.getTable(name); } } }
/** Returns a {@link Queryable}, given a schema and table name. */ public static <E> Queryable<E> queryable(DataContext root, SchemaPlus schema, Class<E> clazz, String tableName) { QueryableTable table = (QueryableTable) schema.getTable(tableName); return table.asQueryable(root.getQueryProvider(), schema, tableName); }
/** Returns a {@link Queryable}, given a schema and table name. */ public static <E> Queryable<E> queryable(DataContext root, SchemaPlus schema, Class<E> clazz, String tableName) { QueryableTable table = (QueryableTable) schema.getTable(tableName); return table.asQueryable(root.getQueryProvider(), schema, tableName); }
public Table getTable(SchemaPlus rootSchema){ List<FolderName> components = this.getFolderPath(); SchemaPlus schema = rootSchema.getSubSchema(this.getRoot().getName()); if(schema == null){ throw new IllegalStateException(String.format("Failure finding schema path %s in position 0 of path %s", getRoot().getName(), toPathString())); } int i = 1; for(FolderName folder : components){ schema = schema.getSubSchema(folder.getName()); if(schema == null){ throw new IllegalStateException(String.format("Failure finding schema path %s in position %d of path %s", folder.getName(), i, toPathString())); } i++; } Table table = schema.getTable(getLeaf().getName()); if(table == null){ throw new IllegalStateException(String.format("Failure finding table in path %s. The schema exists but no table in that schema matches %s", toPathString(), getLeaf().getName())); } return table; }
final Table table = schema.getTable(tableName);
if (schema.getTable(tableName) == null) { throw UserException.validationError() .message("Unknown table [%s] in schema [%s]", tableName, schemaPath)