use of com.linkedin.pinot.core.operator.query.MSelectionOrderByOperator in project pinot by linkedin.
the class InnerSegmentSelectionMultiValueQueriesTest method testSelectionOrderBy.
@Test
public void testSelectionOrderBy() {
String query = "SELECT" + SELECTION + " FROM testTable" + ORDER_BY;
// Test query without filter.
MSelectionOrderByOperator selectionOrderByOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOrderByOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOrderByOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 100000L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 400000L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 4);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column5");
Assert.assertEquals(selectionDataSchema.getColumnName(3), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.STRING);
Assert.assertEquals(selectionDataSchema.getColumnType(3), FieldSpec.DataType.INT_ARRAY);
Queue<Serializable[]> selectionResult = (Queue<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] lastRow = selectionResult.peek();
Assert.assertEquals(lastRow.length, 4);
Assert.assertEquals((String) lastRow[0], "AKXcXcIqsqOJFsdwxZ");
Assert.assertEquals(lastRow[3], new int[] { 1252 });
// Test query with filter.
selectionOrderByOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOrderByOperator.nextBlock();
executionStatistics = selectionOrderByOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 15620L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 282430L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 62480L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 100000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 4);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column5");
Assert.assertEquals(selectionDataSchema.getColumnName(3), "column6");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.STRING);
Assert.assertEquals(selectionDataSchema.getColumnType(3), FieldSpec.DataType.INT_ARRAY);
selectionResult = (Queue<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
lastRow = selectionResult.peek();
Assert.assertEquals(lastRow.length, 4);
Assert.assertEquals((String) lastRow[0], "AKXcXcIqsqOJFsdwxZ");
Assert.assertEquals(lastRow[3], new int[] { 2147483647 });
}
use of com.linkedin.pinot.core.operator.query.MSelectionOrderByOperator in project pinot by linkedin.
the class InnerSegmentSelectionSingleValueQueriesTest method testSelectionOrderBy.
@Test
public void testSelectionOrderBy() {
String query = "SELECT" + SELECTION + " FROM testTable" + ORDER_BY;
// Test query without filter.
MSelectionOrderByOperator selectionOrderByOperator = getOperatorForQuery(query);
IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) selectionOrderByOperator.nextBlock();
ExecutionStatistics executionStatistics = selectionOrderByOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 30000L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 0L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 120000L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
DataSchema selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 4);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column6");
Assert.assertEquals(selectionDataSchema.getColumnName(1), "column1");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.INT);
Queue<Serializable[]> selectionResult = (Queue<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
Serializable[] lastRow = selectionResult.peek();
Assert.assertEquals(lastRow.length, 4);
Assert.assertEquals(((Integer) lastRow[0]).intValue(), 6043515);
Assert.assertEquals(((Integer) lastRow[1]).intValue(), 10542595);
// Test query with filter.
selectionOrderByOperator = getOperatorForQueryWithFilter(query);
resultsBlock = (IntermediateResultsBlock) selectionOrderByOperator.nextBlock();
executionStatistics = selectionOrderByOperator.getExecutionStatistics();
Assert.assertEquals(executionStatistics.getNumDocsScanned(), 6129L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedInFilter(), 84134L);
Assert.assertEquals(executionStatistics.getNumEntriesScannedPostFilter(), 24516L);
Assert.assertEquals(executionStatistics.getNumTotalRawDocs(), 30000L);
selectionDataSchema = resultsBlock.getSelectionDataSchema();
Assert.assertEquals(selectionDataSchema.size(), 4);
Assert.assertEquals(selectionDataSchema.getColumnName(0), "column6");
Assert.assertEquals(selectionDataSchema.getColumnName(1), "column1");
Assert.assertEquals(selectionDataSchema.getColumnType(0), FieldSpec.DataType.INT);
Assert.assertEquals(selectionDataSchema.getColumnType(1), FieldSpec.DataType.INT);
selectionResult = (Queue<Serializable[]>) resultsBlock.getSelectionResult();
Assert.assertEquals(selectionResult.size(), 10);
lastRow = selectionResult.peek();
Assert.assertEquals(lastRow.length, 4);
Assert.assertEquals(((Integer) lastRow[0]).intValue(), 6043515);
Assert.assertEquals(((Integer) lastRow[1]).intValue(), 462769197);
}
Aggregations