Search in sources :

Example 1 with StrictParameterConverter

use of com.hazelcast.jet.sql.impl.validate.param.StrictParameterConverter in project hazelcast by hazelcast.

the class OptimizerTestSupport method context.

private static OptimizerContext context(HazelcastSchema schema, QueryDataType... parameterTypes) {
    OptimizerContext context = OptimizerContext.create(HazelcastSchemaUtils.createCatalog(schema), QueryUtils.prepareSearchPaths(null, null), emptyList(), 1, name -> null);
    ParameterConverter[] parameterConverters = IntStream.range(0, parameterTypes.length).mapToObj(i -> new StrictParameterConverter(i, SqlParserPos.ZERO, parameterTypes[i])).toArray(ParameterConverter[]::new);
    QueryParameterMetadata parameterMetadata = new QueryParameterMetadata(parameterConverters);
    context.setParameterMetadata(parameterMetadata);
    return context;
}
Also used : IntStream(java.util.stream.IntStream) OptimizerContext(com.hazelcast.jet.sql.impl.OptimizerContext) LogicalRules(com.hazelcast.jet.sql.impl.opt.logical.LogicalRules) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) QueryDataType(com.hazelcast.sql.impl.type.QueryDataType) PhysicalRules(com.hazelcast.jet.sql.impl.opt.physical.PhysicalRules) SCHEMA_NAME_PUBLIC(com.hazelcast.jet.sql.impl.schema.TableResolverImpl.SCHEMA_NAME_PUBLIC) RelOptUtil(org.apache.calcite.plan.RelOptUtil) QueryParameterMetadata(com.hazelcast.sql.impl.QueryParameterMetadata) HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) ParameterConverter(com.hazelcast.sql.impl.ParameterConverter) Collectors.toMap(java.util.stream.Collectors.toMap) LogicalRel(com.hazelcast.jet.sql.impl.opt.logical.LogicalRel) Arrays.asList(java.util.Arrays.asList) ConstantTableStatistics(com.hazelcast.sql.impl.schema.ConstantTableStatistics) HazelcastSchemaUtils(com.hazelcast.jet.sql.impl.schema.HazelcastSchemaUtils) QueryUtils(com.hazelcast.sql.impl.QueryUtils) PartitionedMapTable(com.hazelcast.sql.impl.schema.map.PartitionedMapTable) SqlParserPos(org.apache.calcite.sql.parser.SqlParserPos) StrictParameterConverter(com.hazelcast.jet.sql.impl.validate.param.StrictParameterConverter) HazelcastTableStatistic(com.hazelcast.jet.sql.impl.schema.HazelcastTableStatistic) Collections.emptyList(java.util.Collections.emptyList) SqlTestSupport(com.hazelcast.jet.sql.SqlTestSupport) SqlExplainLevel(org.apache.calcite.sql.SqlExplainLevel) RelNode(org.apache.calcite.rel.RelNode) HazelcastSchema(com.hazelcast.jet.sql.impl.schema.HazelcastSchema) Objects(java.util.Objects) TableField(com.hazelcast.sql.impl.schema.TableField) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) StringReader(java.io.StringReader) QueryParseResult(com.hazelcast.jet.sql.impl.parse.QueryParseResult) MapTableIndex(com.hazelcast.sql.impl.schema.map.MapTableIndex) Function.identity(java.util.function.Function.identity) BufferedReader(java.io.BufferedReader) Arrays.stream(java.util.Arrays.stream) PhysicalRel(com.hazelcast.jet.sql.impl.opt.physical.PhysicalRel) StrictParameterConverter(com.hazelcast.jet.sql.impl.validate.param.StrictParameterConverter) ParameterConverter(com.hazelcast.sql.impl.ParameterConverter) StrictParameterConverter(com.hazelcast.jet.sql.impl.validate.param.StrictParameterConverter) QueryParameterMetadata(com.hazelcast.sql.impl.QueryParameterMetadata) OptimizerContext(com.hazelcast.jet.sql.impl.OptimizerContext)

Aggregations

SqlTestSupport (com.hazelcast.jet.sql.SqlTestSupport)1 OptimizerContext (com.hazelcast.jet.sql.impl.OptimizerContext)1 LogicalRel (com.hazelcast.jet.sql.impl.opt.logical.LogicalRel)1 LogicalRules (com.hazelcast.jet.sql.impl.opt.logical.LogicalRules)1 PhysicalRel (com.hazelcast.jet.sql.impl.opt.physical.PhysicalRel)1 PhysicalRules (com.hazelcast.jet.sql.impl.opt.physical.PhysicalRules)1 QueryParseResult (com.hazelcast.jet.sql.impl.parse.QueryParseResult)1 HazelcastSchema (com.hazelcast.jet.sql.impl.schema.HazelcastSchema)1 HazelcastSchemaUtils (com.hazelcast.jet.sql.impl.schema.HazelcastSchemaUtils)1 HazelcastTable (com.hazelcast.jet.sql.impl.schema.HazelcastTable)1 HazelcastTableStatistic (com.hazelcast.jet.sql.impl.schema.HazelcastTableStatistic)1 SCHEMA_NAME_PUBLIC (com.hazelcast.jet.sql.impl.schema.TableResolverImpl.SCHEMA_NAME_PUBLIC)1 StrictParameterConverter (com.hazelcast.jet.sql.impl.validate.param.StrictParameterConverter)1 ParameterConverter (com.hazelcast.sql.impl.ParameterConverter)1 QueryParameterMetadata (com.hazelcast.sql.impl.QueryParameterMetadata)1 QueryUtils (com.hazelcast.sql.impl.QueryUtils)1 ConstantTableStatistics (com.hazelcast.sql.impl.schema.ConstantTableStatistics)1 TableField (com.hazelcast.sql.impl.schema.TableField)1 MapTableIndex (com.hazelcast.sql.impl.schema.map.MapTableIndex)1 PartitionedMapTable (com.hazelcast.sql.impl.schema.map.PartitionedMapTable)1