Search in sources :

Example 1 with VertexWithInputConfig

use of com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig in project hazelcast by hazelcast.

the class CreateDagVisitor method onNestedLoopJoin.

public Vertex onNestedLoopJoin(JoinNestedLoopPhysicalRel rel) {
    assert rel.getRight() instanceof FullScanPhysicalRel : rel.getRight().getClass();
    Table rightTable = rel.getRight().getTable().unwrap(HazelcastTable.class).getTarget();
    collectObjectKeys(rightTable);
    VertexWithInputConfig vertexWithConfig = getJetSqlConnector(rightTable).nestedLoopReader(dag, rightTable, rel.rightFilter(parameterMetadata), rel.rightProjection(parameterMetadata), rel.joinInfo(parameterMetadata));
    Vertex vertex = vertexWithConfig.vertex();
    connectInput(rel.getLeft(), vertex, vertexWithConfig.configureEdgeFn());
    return vertex;
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Table(com.hazelcast.sql.impl.schema.Table) VertexWithInputConfig(com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig) HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable)

Example 2 with VertexWithInputConfig

use of com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig in project hazelcast by hazelcast.

the class CreateDagVisitor method onInsert.

public Vertex onInsert(InsertPhysicalRel rel) {
    Table table = rel.getTable().unwrap(HazelcastTable.class).getTarget();
    collectObjectKeys(table);
    VertexWithInputConfig vertexWithConfig = getJetSqlConnector(table).insertProcessor(dag, table);
    Vertex vertex = vertexWithConfig.vertex();
    connectInput(rel.getInput(), vertex, vertexWithConfig.configureEdgeFn());
    return vertex;
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable) Table(com.hazelcast.sql.impl.schema.Table) VertexWithInputConfig(com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig) HazelcastTable(com.hazelcast.jet.sql.impl.schema.HazelcastTable)

Example 3 with VertexWithInputConfig

use of com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig in project hazelcast by hazelcast.

the class JoinerTest method test_joinByPredicate.

@Test
@Parameters(method = "joinTypes")
public void test_joinByPredicate(JoinRelType joinType) {
    // given
    given(rightRowProjectorSupplier.paths()).willReturn(new QueryPath[] { QueryPath.create("path") });
    given(dag.newUniqueVertex(contains("Predicate"), isA(ProcessorMetaSupplier.class))).willReturn(vertex);
    // when
    VertexWithInputConfig vertexWithConfig = Joiner.join(dag, "imap-name", "table-name", joinInfo(joinType, new int[] { 0 }, new int[] { 0 }), rightRowProjectorSupplier);
    // then
    assertThat(vertexWithConfig.vertex()).isEqualTo(vertex);
    assertThat(vertexWithConfig.configureEdgeFn()).isNotNull();
}
Also used : VertexWithInputConfig(com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig) ProcessorMetaSupplier(com.hazelcast.jet.core.ProcessorMetaSupplier) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 4 with VertexWithInputConfig

use of com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig in project hazelcast by hazelcast.

the class JoinerTest method test_joinByPrimitiveKey.

@Test
@Parameters(method = "joinTypes")
public void test_joinByPrimitiveKey(JoinRelType joinType) {
    // given
    given(rightRowProjectorSupplier.paths()).willReturn(new QueryPath[] { KEY_PATH });
    given(dag.newUniqueVertex(contains("Lookup"), isA(JoinByPrimitiveKeyProcessorSupplier.class))).willReturn(vertex);
    // when
    VertexWithInputConfig vertexWithConfig = Joiner.join(dag, "imap-name", "table-name", joinInfo(joinType, new int[] { 0 }, new int[] { 0 }), rightRowProjectorSupplier);
    // then
    assertThat(vertexWithConfig.vertex()).isEqualTo(vertex);
    assertThat(vertexWithConfig.configureEdgeFn()).isNotNull();
}
Also used : VertexWithInputConfig(com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 5 with VertexWithInputConfig

use of com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig in project hazelcast by hazelcast.

the class JoinerTest method test_joinByScan.

@Test
@Parameters(method = "joinTypes")
public void test_joinByScan(JoinRelType joinType) {
    // given
    given(rightRowProjectorSupplier.paths()).willReturn(new QueryPath[] { VALUE_PATH });
    given(dag.newUniqueVertex(contains("Scan"), isA(JoinScanProcessorSupplier.class))).willReturn(vertex);
    // when
    VertexWithInputConfig vertexWithConfig = Joiner.join(dag, "imap-name", "table-name", joinInfo(joinType, new int[0], new int[0]), rightRowProjectorSupplier);
    // then
    assertThat(vertexWithConfig.vertex()).isEqualTo(vertex);
    assertThat(vertexWithConfig.configureEdgeFn()).isNull();
}
Also used : VertexWithInputConfig(com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig) Parameters(junitparams.Parameters) Test(org.junit.Test)

Aggregations

VertexWithInputConfig (com.hazelcast.jet.sql.impl.connector.SqlConnector.VertexWithInputConfig)5 Parameters (junitparams.Parameters)3 Test (org.junit.Test)3 Vertex (com.hazelcast.jet.core.Vertex)2 HazelcastTable (com.hazelcast.jet.sql.impl.schema.HazelcastTable)2 Table (com.hazelcast.sql.impl.schema.Table)2 ProcessorMetaSupplier (com.hazelcast.jet.core.ProcessorMetaSupplier)1