use of com.hazelcast.jet.sql.impl.connector.infoschema.ViewsTable in project hazelcast by hazelcast.
the class TableResolverImpl method getTables.
@Nonnull
@Override
public List<Table> getTables() {
Collection<Object> objects = tableStorage.allObjects();
List<Table> tables = new ArrayList<>(objects.size() + 3);
for (Object o : objects) {
if (o instanceof Mapping) {
tables.add(toTable((Mapping) o));
} else if (o instanceof View) {
tables.add(toTable((View) o));
} else {
throw new RuntimeException("Unexpected: " + o);
}
}
Collection<Mapping> mappings = objects.stream().filter(o -> o instanceof Mapping).map(m -> (Mapping) m).collect(Collectors.toList());
Collection<View> views = objects.stream().filter(o -> o instanceof View).map(v -> (View) v).collect(Collectors.toList());
tables.add(new TablesTable(CATALOG, SCHEMA_NAME_INFORMATION_SCHEMA, SCHEMA_NAME_PUBLIC, mappings, views));
tables.add(new MappingsTable(CATALOG, SCHEMA_NAME_INFORMATION_SCHEMA, SCHEMA_NAME_PUBLIC, mappings));
tables.add(new MappingColumnsTable(CATALOG, SCHEMA_NAME_INFORMATION_SCHEMA, SCHEMA_NAME_PUBLIC, mappings, views));
tables.add(new ViewsTable(CATALOG, SCHEMA_NAME_INFORMATION_SCHEMA, SCHEMA_NAME_PUBLIC, views));
return tables;
}
Aggregations