use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.
the class TestSortEmitOutcome method testSpillWithNoEmitOutcome.
/**
* Verifies successful spilling in absence of EMIT outcome
* @throws Exception
*/
@Test
public void testSpillWithNoEmitOutcome() 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_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_nonEmptyInputRowSet1.container());
inputContainer.add(local_nonEmptyInputRowSet2.container());
inputContainer.add(local_nonEmptyInputRowSet3.container());
inputOutcomes.add(OK_NEW_SCHEMA);
inputOutcomes.add(OK);
inputOutcomes.add(OK);
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_nonEmptyInputRowSet1.container().getSchema());
final ExternalSortBatch sortBatch_local = new ExternalSortBatch(sortPopConfig, fixture_local.getFragmentContext(), mockInputBatch);
assertTrue(sortBatch_local.next() == OK_NEW_SCHEMA);
assertTrue(sortBatch_local.next() == OK_NEW_SCHEMA);
assertTrue(sortBatch_local.getRecordCount() == 4);
assertTrue(sortBatch_local.getSchema().getSelectionVectorMode() == BatchSchema.SelectionVectorMode.NONE);
assertTrue(sortBatch_local.next() == NONE);
// Release memory for row sets
local_nonEmptyInputRowSet1.clear();
local_nonEmptyInputRowSet2.clear();
local_nonEmptyInputRowSet3.clear();
sortBatch_local.close();
fixture_local.close();
}
use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.
the class TestLateralJoinCorrectness method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
PhysicalOperator mockPopConfig = new MockStorePOP(null);
operatorContext = fixture.newOperatorContext(mockPopConfig);
ljPopConfig = new LateralJoinPOP(null, null, JoinRelType.INNER, DrillLateralJoinRelBase.IMPLICIT_COLUMN, Lists.newArrayList());
leftSchema = new SchemaBuilder().add("id_left", TypeProtos.MinorType.INT).add("cost_left", TypeProtos.MinorType.INT).add("name_left", TypeProtos.MinorType.VARCHAR).buildSchema();
emptyLeftRowSet = fixture.rowSetBuilder(leftSchema).build();
rightSchema = new SchemaBuilder().add(ljPopConfig.getImplicitRIDColumn(), TypeProtos.MinorType.INT).add("id_right", TypeProtos.MinorType.INT).add("cost_right", TypeProtos.MinorType.INT).add("name_right", TypeProtos.MinorType.VARCHAR).buildSchema();
emptyRightRowSet = fixture.rowSetBuilder(rightSchema).build();
}
use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.
the class BaseTestOpBatchEmitOutcome method beforeTest.
@Before
public void beforeTest() throws Exception {
emptyInputRowSet = operatorFixture.rowSetBuilder(inputSchema).build();
nonEmptyInputRowSet = operatorFixture.rowSetBuilder(inputSchema).addRow(1, 10, "item1").build();
final PhysicalOperator mockPopConfig = new MockStorePOP(null);
mockOpContext(mockPopConfig, 0, 0);
}
use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.
the class TestUnnestCorrectness method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
mockPopConfig = new MockStorePOP(null);
operatorContext = fixture.newOperatorContext(mockPopConfig);
}
use of org.apache.drill.exec.store.mock.MockStorePOP in project drill by apache.
the class TestLateralJoinCorrectnessBatchProcessing method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
PhysicalOperator mockPopConfig = new MockStorePOP(null);
operatorContext = fixture.newOperatorContext(mockPopConfig);
ljPopConfig = new LateralJoinPOP(null, null, JoinRelType.INNER, DrillLateralJoinRelBase.IMPLICIT_COLUMN, Lists.newArrayList());
leftSchema = new SchemaBuilder().add("id_left", TypeProtos.MinorType.INT).add("cost_left", TypeProtos.MinorType.INT).add("name_left", TypeProtos.MinorType.VARCHAR).buildSchema();
emptyLeftRowSet = fixture.rowSetBuilder(leftSchema).build();
rightSchema = new SchemaBuilder().add(ljPopConfig.getImplicitRIDColumn(), TypeProtos.MinorType.INT).add("id_right", TypeProtos.MinorType.INT).add("cost_right", TypeProtos.MinorType.INT).add("name_right", TypeProtos.MinorType.VARCHAR).buildSchema();
emptyRightRowSet = fixture.rowSetBuilder(rightSchema).build();
expectedSchema = new SchemaBuilder().add("id_left", TypeProtos.MinorType.INT).add("cost_left", TypeProtos.MinorType.INT).add("name_left", TypeProtos.MinorType.VARCHAR).add("id_right", TypeProtos.MinorType.INT).add("cost_right", TypeProtos.MinorType.INT).add("name_right", TypeProtos.MinorType.VARCHAR).buildSchema();
expectedSchemaLeftJoin = new SchemaBuilder().add("id_left", TypeProtos.MinorType.INT).add("cost_left", TypeProtos.MinorType.INT).add("name_left", TypeProtos.MinorType.VARCHAR).add("id_right", TypeProtos.MinorType.INT, TypeProtos.DataMode.OPTIONAL).add("cost_right", TypeProtos.MinorType.INT, TypeProtos.DataMode.OPTIONAL).add("name_right", TypeProtos.MinorType.VARCHAR, TypeProtos.DataMode.OPTIONAL).buildSchema();
}
Aggregations