use of com.linkedin.pinot.core.operator.query.MSelectionOnlyOperator in project pinot by linkedin.
the class InnerSegmentSelectionMultiValueQueriesTest method testSelectStar.
@Test
public void testSelectStar() {
String query = "SELECT * FROM testTable";
// Test query without filter.
MSelectionOnlyOperator selectionOnlyOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 100L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 10);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(5), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(5), FieldSpec.DataType.INT_ARRAY);
List<Serializable[]> selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 10);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 890282370);
Assert.assertEquals(firstRow[5], new int[] { 2147483647 });
// Test query with filter.
selectionOnlyOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 230501L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 100L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 10);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(5), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(5), FieldSpec.DataType.INT_ARRAY);
selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 10);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 890282370);
Assert.assertEquals(firstRow[5], new int[] { 2147483647 });
}
use of com.linkedin.pinot.core.operator.query.MSelectionOnlyOperator in project pinot by linkedin.
the class InnerSegmentSelectionMultiValueQueriesTest method testSelectionOnly.
@Test
public void testSelectionOnly() {
String query = "SELECT" + SELECTION + " FROM testTable";
MSelectionOnlyOperator selectionOnlyOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 30L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 3);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(2), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(2), FieldSpec.DataType.INT_ARRAY);
List<Serializable[]> selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 3);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 890282370);
Assert.assertEquals(firstRow[2], new int[] { 2147483647 });
// Test query with filter.
selectionOnlyOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 230501L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 30L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 3);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(2), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(2), FieldSpec.DataType.INT_ARRAY);
selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 3);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 890282370);
Assert.assertEquals(firstRow[2], new int[] { 2147483647 });
}
use of com.linkedin.pinot.core.operator.query.MSelectionOnlyOperator in project pinot by linkedin.
the class InnerSegmentSelectionSingleValueQueriesTest method testSelectionOnly.
@Test
public void testSelectionOnly() {
String query = "SELECT" + SELECTION + " FROM testTable";
// Test query without filter.
MSelectionOnlyOperator selectionOnlyOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 30L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 3);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(2), "column11");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.STRING);
List<Serializable[]> selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 3);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 1578964907);
Assert.assertEquals((String) firstRow[2], "P");
// Test query with filter.
selectionOnlyOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 48241L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 30L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 3);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(2), "column11");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.STRING);
selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 3);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 351823652);
Assert.assertEquals((String) firstRow[2], "t");
}
use of com.linkedin.pinot.core.operator.query.MSelectionOnlyOperator in project pinot by linkedin.
the class InnerSegmentSelectionSingleValueQueriesTest method testSelectStar.
@Test
public void testSelectStar() {
String query = "SELECT * FROM testTable";
// Test query without filter.
MSelectionOnlyOperator selectionOnlyOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 110L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 11);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(1), "column11");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.STRING);
List<Serializable[]> selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 11);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 1578964907);
Assert.assertEquals((String) firstRow[1], "P");
// Test query with filter.
selectionOnlyOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOnlyOperator.nextBlock();
executionStatistics = selectionOnlyOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 10L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 48241L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 110L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 11);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column1");
Assert.assertEquals(selectionDataSchema.getColumnName(1), "column11");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.STRING);
selectionResult = (List<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
firstRow = selectionResult.get(0);
Assert.assertEquals(firstRow.length, 11);
Assert.assertEquals(((Integer) firstRow[0]).intValue(), 351823652);
Assert.assertEquals((String) firstRow[1], "t");
}
Aggregations