Skip to content

Commit

Permalink
Fix UTs and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tibrewalpratik17 committed Sep 3, 2023
1 parent 2808f64 commit 7d783ca
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
6 changes: 6 additions & 0 deletions pinot-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pinot</groupId>
<artifactId>pinot-query-event-listener</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.pinot.core.transport.server.routing.stats.ServerRoutingStatsManager;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.metrics.PinotMetricUtils;
import org.apache.pinot.spi.queryeventlistener.PinotBrokerQueryEventListenerUtils;
import org.apache.pinot.spi.trace.RequestContext;
import org.apache.pinot.spi.trace.Tracing;
import org.apache.pinot.spi.utils.BytesUtils;
Expand Down Expand Up @@ -183,7 +184,8 @@ public void testBrokerRequestHandler()
SingleConnectionBrokerRequestHandler requestHandler =
new SingleConnectionBrokerRequestHandler(new PinotConfiguration(), "testBrokerId", null, ACCESS_CONTROL_FACTORY,
null, null, new BrokerMetrics("", PinotMetricUtils.getPinotMetricsRegistry(), true, Collections.emptySet()),
null, null, mock(ServerRoutingStatsManager.class), null);
null, null, mock(ServerRoutingStatsManager.class),
PinotBrokerQueryEventListenerUtils.getBrokerQueryEventListener());

long randNum = RANDOM.nextLong();
byte[] randBytes = new byte[12];
Expand Down Expand Up @@ -211,7 +213,8 @@ public void testBrokerRequestHandlerWithAsFunction()
SingleConnectionBrokerRequestHandler requestHandler =
new SingleConnectionBrokerRequestHandler(new PinotConfiguration(), "testBrokerId", null, ACCESS_CONTROL_FACTORY,
null, null, new BrokerMetrics("", PinotMetricUtils.getPinotMetricsRegistry(), true, Collections.emptySet()),
null, null, mock(ServerRoutingStatsManager.class), null);
null, null, mock(ServerRoutingStatsManager.class),
PinotBrokerQueryEventListenerUtils.getBrokerQueryEventListener());
long currentTsMin = System.currentTimeMillis();
JsonNode request = JsonUtils.stringToJsonNode(
"{\"sql\":\"SELECT now() as currentTs, fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z') as firstDayOf2020\"}");
Expand Down Expand Up @@ -418,7 +421,8 @@ public void testExplainPlanLiteralOnly()
SingleConnectionBrokerRequestHandler requestHandler =
new SingleConnectionBrokerRequestHandler(new PinotConfiguration(), "testBrokerId", null, ACCESS_CONTROL_FACTORY,
null, null, new BrokerMetrics("", PinotMetricUtils.getPinotMetricsRegistry(), true, Collections.emptySet()),
null, null, mock(ServerRoutingStatsManager.class), null);
null, null, mock(ServerRoutingStatsManager.class),
PinotBrokerQueryEventListenerUtils.getBrokerQueryEventListener());

// Test 1: select constant
JsonNode request = JsonUtils.stringToJsonNode("{\"sql\":\"EXPLAIN PLAN FOR SELECT 1.5, 'test'\"}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.pinot.common.config.provider.TableCache;
import org.apache.pinot.common.metrics.BrokerMetrics;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.queryeventlistener.PinotBrokerQueryEventListenerUtils;
import org.apache.pinot.spi.trace.DefaultRequestContext;
import org.apache.pinot.spi.trace.RequestContext;
import org.apache.pinot.spi.utils.CommonConstants;
Expand Down Expand Up @@ -65,8 +66,9 @@ public void setUp() {
_config.setProperty(CommonConstants.MultiStageQueryRunner.KEY_OF_QUERY_RUNNER_PORT, "12345");
_accessControlFactory = new AllowAllAccessControlFactory();
_requestHandler =
new MultiStageBrokerRequestHandler(_config, "Broker_localhost", _routingManager, _accessControlFactory,
_queryQuotaManager, _tableCache, _brokerMetrics, null);
new MultiStageBrokerRequestHandler(_config, "Broker_localhost", _routingManager,
_accessControlFactory, _queryQuotaManager, _tableCache, _brokerMetrics,
PinotBrokerQueryEventListenerUtils.getBrokerQueryEventListener());
}

@Test
Expand Down
5 changes: 5 additions & 0 deletions pinot-integration-test-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<artifactId>pinot-yammer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.pinot</groupId>
<artifactId>pinot-query-event-listener</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions pinot-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pinot</groupId>
<artifactId>pinot-query-event-listener</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions pinot-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.pinot</groupId>
<artifactId>pinot-query-event-listener</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
Expand Down

0 comments on commit 7d783ca

Please sign in to comment.