use of com.hazelcast.sql.impl.schema.TableResolver in project hazelcast by hazelcast.
the class ParserOperationsTest method createContext.
private static OptimizerContext createContext() {
PartitionedMapTable partitionedMapTable = new PartitionedMapTable("public", "t", "t", Arrays.asList(field("a"), field("b")), new ConstantTableStatistics(100L), null, null, null, null, null, false);
TableResolver resolver = TestTableResolver.create("public", partitionedMapTable);
List<TableResolver> tableResolvers = Collections.singletonList(resolver);
List<List<String>> searchPaths = QueryUtils.prepareSearchPaths(emptyList(), tableResolvers);
return OptimizerContext.create(new SqlCatalog(tableResolvers), searchPaths, emptyList(), 1, name -> null);
}
use of com.hazelcast.sql.impl.schema.TableResolver in project hazelcast by hazelcast.
the class ParserNameResolutionTest method createContext.
private static OptimizerContext createContext() {
PartitionedMapTable table1 = new PartitionedMapTable(SCHEMA_1, TABLE_1, TABLE_1, Arrays.asList(field(FIELD_1), field(FIELD_2)), new ConstantTableStatistics(100L), null, null, null, null, null, false);
PartitionedMapTable table2 = new PartitionedMapTable(SCHEMA_2, TABLE_2, TABLE_2, Arrays.asList(field(FIELD_1), field(FIELD_2)), new ConstantTableStatistics(100L), null, null, null, null, null, false);
TableResolver resolver1 = TestTableResolver.create(SCHEMA_1, table1);
TableResolver resolver2 = TestTableResolver.create(SCHEMA_2, table2);
List<TableResolver> tableResolvers = Arrays.asList(resolver1, resolver2);
List<List<String>> searchPaths = QueryUtils.prepareSearchPaths(emptyList(), tableResolvers);
return OptimizerContext.create(new SqlCatalog(tableResolvers), searchPaths, emptyList(), 1, name -> null);
}
use of com.hazelcast.sql.impl.schema.TableResolver in project hazelcast by hazelcast.
the class QueryUtils method prepareSearchPaths.
public static List<List<String>> prepareSearchPaths(List<List<String>> currentSearchPaths, List<TableResolver> tableResolvers) {
// Current search paths have the highest priority.
List<List<String>> res = new ArrayList<>();
if (currentSearchPaths != null) {
res.addAll(currentSearchPaths);
}
// Then add paths from table resolvers.
if (tableResolvers != null) {
for (TableResolver tableResolver : tableResolvers) {
res.addAll(tableResolver.getDefaultSearchPaths());
}
}
// Add catalog scope.
res.add(Collections.singletonList(QueryUtils.CATALOG));
// Add top-level scope.
res.add(Collections.emptyList());
return res;
}
Aggregations