Search in sources :

Example 6 with MockStorePOP

use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.

the class TestHashJoinOutcome method beforeTest.

@Before
public void beforeTest() throws Exception {
    prepareUninitContainers(uninitialized2ndInputContainersLeft, batchSchemaLeft);
    prepareUninitContainers(uninitialized2ndInputContainersRight, batchSchemaRight);
    nonEmptyInputRowSetRight = operatorFixture.rowSetBuilder(inputSchemaRight).addRow(123).build();
    nonEmptyInputRowSetLeft = operatorFixture.rowSetBuilder(inputSchemaLeft).addRow(123).build();
    // Prepare various (empty/non-empty) containers for each side of the join
    emptyInputRowSetLeft = operatorFixture.rowSetBuilder(inputSchemaLeft).build();
    emptyInputRowSetRight = operatorFixture.rowSetBuilder(inputSchemaRight).build();
    inputContainerRight.add(emptyInputRowSetRight.container());
    inputContainerRight.add(nonEmptyInputRowSetRight.container());
    inputContainerLeft.add(emptyInputRowSetLeft.container());
    inputContainerLeft.add(nonEmptyInputRowSetLeft.container());
    final PhysicalOperator mockPopConfig = new MockStorePOP(null);
    mockOpContext(mockPopConfig, 0, 0);
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) MockStorePOP(org.apache.drill.exec.store.mock.MockStorePOP) Before(org.junit.Before)

Example 7 with MockStorePOP

use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.

the class TestUnnestWithLateralCorrectness method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    mockPopConfig = new MockStorePOP(null);
    ljPopConfig = new LateralJoinPOP(null, null, JoinRelType.INNER, DrillLateralJoinRelBase.IMPLICIT_COLUMN, Lists.newArrayList());
    operatorContext = fixture.newOperatorContext(mockPopConfig);
}
Also used : MockStorePOP(org.apache.drill.exec.store.mock.MockStorePOP) LateralJoinPOP(org.apache.drill.exec.physical.config.LateralJoinPOP) BeforeClass(org.junit.BeforeClass)

Example 8 with MockStorePOP

use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.

the class TestSortEmitOutcome method testSpillNotSupportedWithEmitOutcome.

/**
 * Verifies ExternalSortBatch behavior when it sees batches with EMIT outcome but has to spill to disk because of
 * memory pressure. Expectation is currenlty spilling is not supported with EMIT outcome so while preparing the
 * output batch that will be detected and Sort will throw UnsupportedOperationException
 * @throws Exception
 */
@Test(expected = UnsupportedOperationException.class)
public void testSpillNotSupportedWithEmitOutcome() throws Exception {
    final OperatorFixture.Builder builder = OperatorFixture.builder(dirTestWatcher);
    // Configuration that forces Sort to spill after buffering 2 incoming batches with data
    builder.configBuilder().put(ExecConstants.EXTERNAL_SORT_BATCH_LIMIT, 2);
    final OperatorFixture fixture_local = builder.build();
    final RowSet.SingleRowSet local_EmptyInputRowSet = fixture_local.rowSetBuilder(inputSchema).build();
    final RowSet.SingleRowSet local_nonEmptyInputRowSet1 = fixture_local.rowSetBuilder(inputSchema).addRow(3, 30, "item3").addRow(2, 20, "item2").build();
    final RowSet.SingleRowSet local_nonEmptyInputRowSet2 = fixture_local.rowSetBuilder(inputSchema).addRow(1, 10, "item1").build();
    final RowSet.SingleRowSet local_nonEmptyInputRowSet3 = fixture_local.rowSetBuilder(inputSchema).addRow(4, 40, "item4").build();
    inputContainer.add(local_EmptyInputRowSet.container());
    inputContainer.add(local_nonEmptyInputRowSet1.container());
    inputContainer.add(local_nonEmptyInputRowSet2.container());
    inputContainer.add(local_nonEmptyInputRowSet3.container());
    inputContainer.add(local_EmptyInputRowSet.container());
    inputOutcomes.add(OK_NEW_SCHEMA);
    inputOutcomes.add(OK);
    inputOutcomes.add(OK);
    inputOutcomes.add(OK);
    inputOutcomes.add(EMIT);
    final PhysicalOperator mockPopConfig_local = new MockStorePOP(null);
    final OperatorContext opContext_local = fixture_local.getFragmentContext().newOperatorContext(mockPopConfig_local);
    final MockRecordBatch mockInputBatch = new MockRecordBatch(fixture_local.getFragmentContext(), opContext_local, inputContainer, inputOutcomes, local_EmptyInputRowSet.container().getSchema());
    final ExternalSortBatch sortBatch_local = new ExternalSortBatch(sortPopConfig, fixture_local.getFragmentContext(), mockInputBatch);
    assertTrue(sortBatch_local.next() == OK_NEW_SCHEMA);
    // Should throw the exception
    sortBatch_local.next();
    // Release memory for row sets
    local_EmptyInputRowSet.clear();
    local_nonEmptyInputRowSet1.clear();
    local_nonEmptyInputRowSet2.clear();
    local_nonEmptyInputRowSet3.clear();
    sortBatch_local.close();
    fixture_local.close();
}
Also used : PhysicalOperator(org.apache.drill.exec.physical.base.PhysicalOperator) MockStorePOP(org.apache.drill.exec.store.mock.MockStorePOP) OperatorContext(org.apache.drill.exec.ops.OperatorContext) RowSet(org.apache.drill.exec.physical.rowSet.RowSet) OperatorFixture(org.apache.drill.test.OperatorFixture) MockRecordBatch(org.apache.drill.exec.physical.impl.MockRecordBatch) OperatorTest(org.apache.drill.categories.OperatorTest) Test(org.junit.Test)

Aggregations

MockStorePOP (org.apache.drill.exec.store.mock.MockStorePOP)8 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)6 BeforeClass (org.junit.BeforeClass)4 LateralJoinPOP (org.apache.drill.exec.physical.config.LateralJoinPOP)3 OperatorTest (org.apache.drill.categories.OperatorTest)2 OperatorContext (org.apache.drill.exec.ops.OperatorContext)2 MockRecordBatch (org.apache.drill.exec.physical.impl.MockRecordBatch)2 RowSet (org.apache.drill.exec.physical.rowSet.RowSet)2 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)2 OperatorFixture (org.apache.drill.test.OperatorFixture)2 Before (org.junit.Before)2 Test (org.junit.Test)2