This is an automated email from the ASF dual-hosted git repository. siddteotia pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push: new fdef9bd Extract duplicate code in testSelectionOrderByAgoFunction into a single private helper function (#7012) fdef9bd is described below commit fdef9bddd8efa6a6f96882370ff93a72155ac546 Author: Liang Mingqiang <mili...@linkedin.com> AuthorDate: Wed Jun 2 23:59:25 2021 -0700 Extract duplicate code in testSelectionOrderByAgoFunction into a single private helper function (#7012) --- ...nnerSegmentSelectionSingleValueQueriesTest.java | 26 +++++++--------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/InnerSegmentSelectionSingleValueQueriesTest.java b/pinot-core/src/test/java/org/apache/pinot/queries/InnerSegmentSelectionSingleValueQueriesTest.java index e57752d..c0d0c38 100644 --- a/pinot-core/src/test/java/org/apache/pinot/queries/InnerSegmentSelectionSingleValueQueriesTest.java +++ b/pinot-core/src/test/java/org/apache/pinot/queries/InnerSegmentSelectionSingleValueQueriesTest.java @@ -88,35 +88,25 @@ public class InnerSegmentSelectionSingleValueQueriesTest extends BaseSingleValue + "ORDER BY daysSinceEpoch LIMIT 10"; SelectionOrderByOperator selectionOrderByOperator = getOperatorForSqlQuery(query); IntermediateResultsBlock resultsBlock = selectionOrderByOperator.nextBlock(); - - DataSchema selectionDataSchema = resultsBlock.getDataSchema(); - Map<String, Integer> columnIndexMap = computeColumnNameToIndexMap(selectionDataSchema); - Assert.assertEquals(selectionDataSchema.size(), 1); - Assert.assertEquals(getVirtualColumns(selectionDataSchema), 0); - Assert.assertTrue(columnIndexMap.containsKey("daysSinceEpoch")); - Assert.assertEquals(selectionDataSchema.getColumnDataType(columnIndexMap.get("daysSinceEpoch")), - DataSchema.ColumnDataType.INT); - - PriorityQueue<Object[]> selectionResult = (PriorityQueue<Object[]>) resultsBlock.getSelectionResult(); - Assert.assertEquals(selectionResult.size(), 10); - for (Object[] row : selectionResult) { - Assert.assertEquals(row.length, 1); - Assert.assertEquals(((Integer) row[columnIndexMap.get("daysSinceEpoch")]).intValue(), 126164076); - } + verifySelectionOrderByAgoFunctionResult(resultsBlock); query = "SELECT daysSinceEpoch from testTable WHERE fromEpochDays(daysSinceEpoch) > ago('P1D') " + "ORDER BY daysSinceEpoch LIMIT 10"; selectionOrderByOperator = getOperatorForSqlQuery(query); resultsBlock = selectionOrderByOperator.nextBlock(); - selectionDataSchema = resultsBlock.getDataSchema(); - columnIndexMap = computeColumnNameToIndexMap(selectionDataSchema); + verifySelectionOrderByAgoFunctionResult(resultsBlock); + } + + private void verifySelectionOrderByAgoFunctionResult(IntermediateResultsBlock resultsBlock) { + DataSchema selectionDataSchema = resultsBlock.getDataSchema(); + Map<String, Integer> columnIndexMap = computeColumnNameToIndexMap(selectionDataSchema); Assert.assertEquals(selectionDataSchema.size(), 1); Assert.assertEquals(getVirtualColumns(selectionDataSchema), 0); Assert.assertTrue(columnIndexMap.containsKey("daysSinceEpoch")); Assert.assertEquals(selectionDataSchema.getColumnDataType(columnIndexMap.get("daysSinceEpoch")), DataSchema.ColumnDataType.INT); - selectionResult = (PriorityQueue<Object[]>) resultsBlock.getSelectionResult(); + PriorityQueue<Object[]> selectionResult = (PriorityQueue<Object[]>) resultsBlock.getSelectionResult(); Assert.assertEquals(selectionResult.size(), 10); for (Object[] row : selectionResult) { Assert.assertEquals(row.length, 1); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org