agavra commented on code in PR #9726: URL: https://github.com/apache/pinot/pull/9726#discussion_r1014053700
########## pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestBase.java: ########## @@ -71,4 +98,42 @@ protected Object[][] provideQueries() { + " b.col2 NOT IN ('alice', 'charlie')"}, }; } + + public static List<GenericRow> buildRows(String tableName) { + List<GenericRow> rows = new ArrayList<>(NUM_ROWS); + for (int i = 0; i < NUM_ROWS; i++) { Review Comment: if there's just five rows what do you think about hardcoding them? IMO anything less than 30 rows is probably easier to read/understand/write tests for if you can see the rows themselves. (basically if I want to answer the question "what _should_ the result of joining X and Y on condition C result in" it's much easier to reason about that if I can just see the contents of each table.) we'd need to create some helper APIs, but basically i was imagining this would look like: ``` List<GenericRow> tableA = rows( row("foo", "foo", 0, 12345), row("bar", "alice", 1, 12346), ... ); List<GenericRow> tableB = rows(...); ``` Even _better_ would be just having these in a JSON file that I could easily read, and _even **better**_ would be using `INSERT INTO ... VALUES (...), (...)` format. ########## pinot-query-planner/src/test/java/org/apache/pinot/query/testutils/QueryTestUtils.java: ########## @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.query.testutils; + +import java.io.IOException; +import java.net.ServerSocket; + + +public class QueryTestUtils { + + private QueryTestUtils() { + // do not instantiate. + } + + public static int getAvailablePort() { Review Comment: this should be `synchronized` (surprisingly, I've hit issues with this in a previous life) ########## pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java: ########## @@ -157,6 +157,9 @@ private void compareRowEquals(List<Object[]> resultRows, List<Object[]> expected @DataProvider(name = "testDataWithSqlToFinalRowCount") private Object[][] provideTestSqlAndRowCount() { return new Object[][] { + // Hybrid table - hybrid table has a 1-day cut-off from current, so it will always use REALTIME only Review Comment: can we test a hybrid table that has data from both with this new refactor? ########## pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTestBase.java: ########## @@ -127,29 +128,44 @@ protected void addDataToH2(Map<String, List<GenericRow>> rowsMap) public void setUp() throws Exception { DataTableBuilderFactory.setDataTableVersion(DataTableFactory.VERSION_4); - QueryServerEnclosure server1 = new QueryServerEnclosure( - ImmutableMap.of("a", INDEX_DIR_S1_A, "b", INDEX_DIR_S1_B, "c", INDEX_DIR_S1_C, "d_O", INDEX_DIR_S1_D), - QueryEnvironmentTestUtils.SERVER1_SEGMENTS); - QueryServerEnclosure server2 = new QueryServerEnclosure( - ImmutableMap.of("a", INDEX_DIR_S2_A, "c", INDEX_DIR_S2_C, "d_R", INDEX_DIR_S2_D, "d_O", INDEX_DIR_S1_D), - QueryEnvironmentTestUtils.SERVER2_SEGMENTS); + MockInstanceDataManagerFactory factory1 = new MockInstanceDataManagerFactory("server1") + .registerTable(QueryEnvironmentTestBase.SCHEMA_BUILDER.setSchemaName("a").build(), "a_REALTIME") Review Comment: tables must have segments, right? should we consider making them one API call? `registertable(schema, name, segment...)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org