Search in sources :

Example 1 with QueryTargetDescriptor

use of com.hazelcast.sql.impl.extract.QueryTargetDescriptor in project hazelcast by hazelcast.

the class PartitionedMapPlanObjectKeyTest method test_partitioned.

@Test
public void test_partitioned() {
    String schema1 = "schema1";
    String schema2 = "schema2";
    String tableName1 = "table1";
    String tableName2 = "table2";
    String mapName1 = "map1";
    String mapName2 = "map2";
    List<TableField> fields1 = singletonList(new MapTableField("field1", QueryDataType.INT, true, QueryPath.KEY_PATH));
    List<TableField> fields2 = singletonList(new MapTableField("field2", QueryDataType.INT, true, QueryPath.KEY_PATH));
    Set<String> conflictingSchemas1 = Collections.singleton("schema1");
    Set<String> conflictingSchemas2 = Collections.singleton("schema2");
    QueryTargetDescriptor keyDescriptor1 = GenericQueryTargetDescriptor.DEFAULT;
    QueryTargetDescriptor keyDescriptor2 = new TestTargetDescriptor();
    QueryTargetDescriptor valueDescriptor1 = GenericQueryTargetDescriptor.DEFAULT;
    QueryTargetDescriptor valueDescriptor2 = new TestTargetDescriptor();
    Object keyJetMetadata1 = new Object();
    Object valueJetMetadata1 = new Object();
    Object keyJetMetadata2 = new Object();
    Object valueJetMetadata2 = new Object();
    List<MapTableIndex> indexes1 = singletonList(new MapTableIndex("idx", IndexType.SORTED, 0, emptyList(), emptyList()));
    List<MapTableIndex> indexes2 = singletonList(new MapTableIndex("idx", IndexType.HASH, 0, emptyList(), emptyList()));
    boolean hd1 = false;
    boolean hd2 = true;
    PartitionedMapPlanObjectKey objectId = new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), true);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema2, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema2, tableName2, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName2, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields2, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas2, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor2, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor2, keyJetMetadata1, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor2, keyJetMetadata2, valueJetMetadata1, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor2, keyJetMetadata1, valueJetMetadata2, indexes1, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes2, hd1), false);
    checkEquals(objectId, new PartitionedMapPlanObjectKey(schema1, tableName1, mapName1, fields1, conflictingSchemas1, keyDescriptor1, valueDescriptor1, keyJetMetadata1, valueJetMetadata1, indexes1, hd2), false);
}
Also used : GenericQueryTargetDescriptor(com.hazelcast.sql.impl.extract.GenericQueryTargetDescriptor) QueryTargetDescriptor(com.hazelcast.sql.impl.extract.QueryTargetDescriptor) TableField(com.hazelcast.sql.impl.schema.TableField) PartitionedMapPlanObjectKey(com.hazelcast.sql.impl.schema.map.PartitionedMapTable.PartitionedMapPlanObjectKey) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

GenericQueryTargetDescriptor (com.hazelcast.sql.impl.extract.GenericQueryTargetDescriptor)1 QueryTargetDescriptor (com.hazelcast.sql.impl.extract.QueryTargetDescriptor)1 TableField (com.hazelcast.sql.impl.schema.TableField)1 PartitionedMapPlanObjectKey (com.hazelcast.sql.impl.schema.map.PartitionedMapTable.PartitionedMapPlanObjectKey)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1