Returns an org.apache.calcite.linq4j.Enumerable over object arrays, given a fully-qualified table name which leads to a ScannableTable.
(DataContext root, String... names)
| 293 | * arrays, given a fully-qualified table name which leads to a |
| 294 | * {@link ScannableTable}. */ |
| 295 | public static @Nullable Table table(DataContext root, String... names) { |
| 296 | SchemaPlus schema = root.getRootSchema(); |
| 297 | final List<String> nameList = Arrays.asList(names); |
| 298 | for (Iterator<? extends String> iterator = nameList.iterator();;) { |
| 299 | String name = iterator.next(); |
| 300 | requireNonNull(schema, "schema"); |
| 301 | if (iterator.hasNext()) { |
| 302 | SchemaPlus next = schema.subSchemas().get(name); |
| 303 | if (next == null) { |
| 304 | throw new IllegalArgumentException("schema " + name + " is not found in " + schema); |
| 305 | } |
| 306 | schema = next; |
| 307 | } else { |
| 308 | return schema.tables().get(name); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | /** Parses and validates a SQL query. For use within Calcite only. */ |
| 314 | public static CalcitePrepare.ParseResult parse( |
nothing calls this directly
no test coverage detected