Search in sources :

Example 1 with ElementMatch

use of uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch in project Gaffer by gchq.

the class JoinHandlerTest method shouldSetInputToNewArrayListWhenNull.

@Test
public void shouldSetInputToNewArrayListWhenNull() throws OperationException {
    // Given
    final JoinHandler handler = new JoinHandler();
    final Join joinOp = new Join.Builder<>().joinType(JoinType.FULL).matchMethod(new ElementMatch()).matchKey(MatchKey.LEFT).build();
    // When
    handler.doOperation(joinOp, context, store);
    // Then
    assertTrue(joinOp.getInput().equals(new ArrayList<>()));
}
Also used : ElementMatch(uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch) ArrayList(java.util.ArrayList) Join(uk.gov.gchq.gaffer.operation.impl.join.Join) JoinHandler(uk.gov.gchq.gaffer.store.operation.handler.join.JoinHandler) Test(org.junit.jupiter.api.Test)

Example 2 with ElementMatch

use of uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch in project Gaffer by gchq.

the class JoinIT method shouldRightKeyInnerJoin.

@Test
public void shouldRightKeyInnerJoin() throws OperationException {
    // Given
    final List<Element> expectedResults = innerJoinElements;
    Join<Element> joinOp = new Join.Builder<Element>().input(inputElements).operation(rhsGetElementsOperation).joinType(JoinType.INNER).matchKey(MatchKey.RIGHT).matchMethod(new ElementMatch(TestPropertyNames.COUNT)).flatten(false).build();
    // When
    final Iterable<? extends MapTuple> results = graph.execute(joinOp, getUser());
    // Then
    assertKeysExist(expectedResults, results, MatchKey.RIGHT);
}
Also used : ElementMatch(uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch) Element(uk.gov.gchq.gaffer.data.element.Element) Join(uk.gov.gchq.gaffer.operation.impl.join.Join) Test(org.junit.Test)

Example 3 with ElementMatch

use of uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch in project Gaffer by gchq.

the class JoinIT method shouldLeftKeyFullJoin.

@Test
public void shouldLeftKeyFullJoin() throws OperationException {
    // Given
    final List<Element> expectedResults = new ArrayList<>(inputElements);
    Join<Element> joinOp = new Join.Builder<Element>().input(inputElements).operation(rhsGetElementsOperation).joinType(JoinType.FULL).matchKey(MatchKey.LEFT).matchMethod(new ElementMatch(TestPropertyNames.COUNT)).flatten(false).build();
    // When
    final Iterable<? extends MapTuple> results = graph.execute(joinOp, getUser());
    // Then
    assertKeysExist(expectedResults, results, MatchKey.LEFT);
}
Also used : ElementMatch(uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch) Element(uk.gov.gchq.gaffer.data.element.Element) ArrayList(java.util.ArrayList) Join(uk.gov.gchq.gaffer.operation.impl.join.Join) Test(org.junit.Test)

Example 4 with ElementMatch

use of uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch in project Gaffer by gchq.

the class JoinIT method shouldRightKeyFullJoin.

@Test
public void shouldRightKeyFullJoin() throws OperationException {
    // Given
    final List<Element> expectedResults = innerJoinElements;
    expectedResults.add(getJoinEntity(TestGroups.ENTITY_3, 8));
    Join<Element> joinOp = new Join.Builder<Element>().input(inputElements).operation(rhsGetElementsOperation).joinType(JoinType.FULL).matchKey(MatchKey.RIGHT).matchMethod(new ElementMatch(TestPropertyNames.COUNT)).flatten(false).build();
    // When
    final Iterable<? extends MapTuple> results = graph.execute(joinOp, getUser());
    // Then
    assertKeysExist(expectedResults, results, MatchKey.RIGHT);
}
Also used : ElementMatch(uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch) Element(uk.gov.gchq.gaffer.data.element.Element) Join(uk.gov.gchq.gaffer.operation.impl.join.Join) Test(org.junit.Test)

Example 5 with ElementMatch

use of uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch in project Gaffer by gchq.

the class JoinIT method testNestedViewCompletedIfNotSupplied.

@Test
public void testNestedViewCompletedIfNotSupplied() throws Exception {
    // Given
    Join<Element> joinOp = new Join.Builder<Element>().input(inputElements).operation(new GetAllElements()).joinType(JoinType.INNER).matchKey(MatchKey.LEFT).matchMethod(new ElementMatch(TestPropertyNames.COUNT)).build();
    // When / Then - no exceptions
    graph.execute(joinOp, getUser());
}
Also used : ElementMatch(uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch) Element(uk.gov.gchq.gaffer.data.element.Element) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) Test(org.junit.Test)

Aggregations

ElementMatch (uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch)5 Test (org.junit.Test)4 Element (uk.gov.gchq.gaffer.data.element.Element)4 Join (uk.gov.gchq.gaffer.operation.impl.join.Join)4 ArrayList (java.util.ArrayList)2 Test (org.junit.jupiter.api.Test)1 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)1 JoinHandler (uk.gov.gchq.gaffer.store.operation.handler.join.JoinHandler)1