Search in sources :

Example 26 with HazelcastTable

use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.

the class LogicalDeleteTest method test_deleteByKeyWithLiteral.

@Test
@Parameters(method = "literals")
public void test_deleteByKeyWithLiteral(QueryDataType type, String literalValue) {
    HazelcastTable table = partitionedTable("m", asList(field(KEY, type), field(VALUE, VARCHAR)), 1);
    assertPlan(optimizeLogical("DELETE FROM m WHERE __key = " + literalValue, table), plan(planRow(0, DeleteByKeyMapLogicalRel.class)));
    assertPlan(optimizeLogical("DELETE FROM m WHERE " + literalValue + " = __key", table), plan(planRow(0, DeleteByKeyMapLogicalRel.class)));
}
Also used : HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 27 with HazelcastTable

use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.

the class LogicalSelectTest method test_selectByKeyWithProject.

@Test
public void test_selectByKeyWithProject() {
    HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
    assertPlan(optimizeLogical("SELECT this FROM m WHERE __key = 1", table), plan(planRow(0, SelectByKeyMapLogicalRel.class)));
}
Also used : HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Test(org.junit.Test)

Example 28 with HazelcastTable

use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.

the class LogicalSelectTest method test_selectByKeyWithLiteralExpression.

@Test
public void test_selectByKeyWithLiteralExpression() {
    HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
    assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = 1 + 1", table), plan(planRow(0, SelectByKeyMapLogicalRel.class)));
}
Also used : HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Test(org.junit.Test)

Example 29 with HazelcastTable

use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.

the class LogicalSelectTest method test_selectByKeyWithDynamicParamAndImplicitCastOnKey.

@Test
public void test_selectByKeyWithDynamicParamAndImplicitCastOnKey() {
    HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
    assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = ? + 1", table), plan(planRow(0, FullScanLogicalRel.class)));
}
Also used : HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Test(org.junit.Test)

Example 30 with HazelcastTable

use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.

the class LogicalSelectTest method test_selectByKeyWithDynamicParamExpression.

@Test
public void test_selectByKeyWithDynamicParamExpression() {
    HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
    assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = CAST(? + 1 AS INT)", table), plan(planRow(0, SelectByKeyMapLogicalRel.class)));
}
Also used : HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Test(org.junit.Test)

Aggregations

HazelcastTable (com.hazelcast.jet.sql.impl.schema.HazelcastTable)70 Test (org.junit.Test)48 TableField (com.hazelcast.sql.impl.schema.TableField)8 MapTableField (com.hazelcast.sql.impl.schema.map.MapTableField)8 QueryDataType (com.hazelcast.sql.impl.type.QueryDataType)8 IndexScanMapPhysicalRel (com.hazelcast.jet.sql.impl.opt.physical.IndexScanMapPhysicalRel)7 RexNode (org.apache.calcite.rex.RexNode)7 QueryPath (com.hazelcast.sql.impl.extract.QueryPath)6 Parameters (junitparams.Parameters)6 OptimizerTestSupport (com.hazelcast.jet.sql.impl.opt.OptimizerTestSupport)5 HazelcastRelOptTable (com.hazelcast.jet.sql.impl.schema.HazelcastRelOptTable)5 ArrayList (java.util.ArrayList)5 FullScanPhysicalRel (com.hazelcast.jet.sql.impl.opt.physical.FullScanPhysicalRel)4 RelOptTable (org.apache.calcite.plan.RelOptTable)4 RelTraitSet (org.apache.calcite.plan.RelTraitSet)3 RelCollation (org.apache.calcite.rel.RelCollation)3 RelNode (org.apache.calcite.rel.RelNode)3 SqlIdentifier (org.apache.calcite.sql.SqlIdentifier)3 SqlValidatorTable (org.apache.calcite.sql.validate.SqlValidatorTable)3 RexBuilder (org.apache.calcite.rex.RexBuilder)2