You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/03/18 18:47:57 UTC

Re: [PR] Support DISTINCT early-termination budgets (row/no-change/time) and surface partial-result flags [pinot]

Copilot commented on code in PR #17247:
URL: https://github.com/apache/pinot/pull/17247#discussion_r2955540171


##########
pinot-core/src/test/java/org/apache/pinot/queries/DistinctQueriesTest.java:
##########
@@ -384,6 +391,73 @@ public void testSingleColumnDistinctOnlyInnerSegment()
     }
   }
 
+  @Test
+  public void testMaxRowsInDistinctEarlyTerminationInnerSegment() {
+    String query =
+        "SET \"maxRowsInDistinct\" = 5; SELECT DISTINCT(rawIntColumn) FROM testTable LIMIT 100";
+    BaseOperator<DistinctResultsBlock> operator = getOperator(query);
+    DistinctResultsBlock resultsBlock = operator.nextBlock();
+    assertEquals(resultsBlock.getEarlyTerminationReason(), BaseResultsBlock.EarlyTerminationReason.DISTINCT_MAX_ROWS);
+    assertEquals(resultsBlock.getDistinctTable().size(), 5);
+  }
+
+  @Test
+  public void testNumRowsWithoutChangeEarlyTerminationInnerSegment() {
+    // With block-level tracking (block size = 10,000), the first block finds 100 unique values (distinct changed),
+    // and the second block finds 0 new values (10,000 rows without change >= budget of 5,000).
+    String query =
+        "SET \"numRowsWithoutChangeInDistinct\" = 5000; SELECT DISTINCT(rawIntColumn) FROM testTable LIMIT 200";
+    BaseOperator<DistinctResultsBlock> operator = getOperator(query);
+    DistinctResultsBlock resultsBlock = operator.nextBlock();
+    assertEquals(resultsBlock.getEarlyTerminationReason(),
+        BaseResultsBlock.EarlyTerminationReason.DISTINCT_NO_NEW_VALUES);
+    assertEquals(resultsBlock.getDistinctTable().size(), 100);
+  }
+
+  @Test
+  public void testTimeLimitDoesNotCrashInnerSegment() {
+    // Time limit is checked at block boundary. A short budget should not crash even if it doesn't expire
+    // during processing (blocks process in sub-millisecond time in tests).
+    String query =
+        "SET \"maxExecutionTimeMsInDistinct\" = 1; SELECT DISTINCT(rawIntColumn) FROM testTable LIMIT 200";
+    BaseOperator<DistinctResultsBlock> operator = getOperator(query);
+    DistinctResultsBlock resultsBlock = operator.nextBlock();
+    // Time limit may or may not trigger depending on execution speed; just verify no crash
+    assertTrue(resultsBlock.getDistinctTable().size() > 0);
+  }
+
+  @Test
+  public void testTimeLimitIgnoredWithinDictionaryBasedInnerSegment() {
+    // Dictionary-based operator does not apply time limits (reads directly from dictionary)
+    String query =
+        "SET \"maxExecutionTimeMsInDistinct\" = 1; SELECT DISTINCT(intColumn) FROM testTable LIMIT 200";
+    BaseOperator<DistinctResultsBlock> operator = getOperator(query);
+    DistinctResultsBlock resultsBlock = operator.nextBlock();
+    assertEquals(resultsBlock.getEarlyTerminationReason(), BaseResultsBlock.EarlyTerminationReason.NONE);

Review Comment:
   This test comment says the dictionary-based operator "does not apply time limits", but DISTINCT time budgets are now wired through `DistinctOperator` into `DistinctExecutor` (including single-column executors via `BaseSingleColumnDistinctExecutor`). Please update the comment to reflect the current behavior (e.g. "time limit may not trigger because execution is fast"), or adjust the test to assert the intended behavior explicitly.
   



##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/ExecutionStatsAggregator.java:
##########
@@ -234,6 +238,35 @@ public void aggregate(ServerRoutingInstance routingInstance, DataTable dataTable
         Boolean.parseBoolean(metadata.get(DataTable.MetadataKey.NUM_GROUPS_LIMIT_REACHED.getName()));
     _numGroupsWarningLimitReached |=
         Boolean.parseBoolean(metadata.get(DataTable.MetadataKey.NUM_GROUPS_WARNING_LIMIT_REACHED.getName()));
+    String distinctEarlyTermination =
+        metadata.get(DataTable.MetadataKey.EARLY_TERMINATION_REASON.getName());
+    if (distinctEarlyTermination != null) {
+      BaseResultsBlock.EarlyTerminationReason reason = null;
+      if ("TIME_LIMIT".equals(distinctEarlyTermination)) {
+        reason = BaseResultsBlock.EarlyTerminationReason.DISTINCT_TIME_LIMIT;
+      } else {
+        try {
+          reason = BaseResultsBlock.EarlyTerminationReason.valueOf(distinctEarlyTermination);
+        } catch (IllegalArgumentException e) {
+          // Ignore unknown reason.
+        }
+      }
+      if (reason != null) {
+        switch (reason) {
+          case DISTINCT_MAX_ROWS:
+            _maxRowsInDistinctReached = true;
+            break;
+          case DISTINCT_NO_NEW_VALUES:
+            _numRowsWithoutChangeInDistinctReached = true;
+            break;
+          case DISTINCT_TIME_LIMIT:
+            _timeLimitInDistinctReached = true;
+            break;
+          default:
+            break;
+        }
+      }

Review Comment:
   `EARLY_TERMINATION_REASON` metadata is written as `BaseResultsBlock.EarlyTerminationReason.name()` (e.g. `DISTINCT_TIME_LIMIT`). The `"TIME_LIMIT"` string special-case likely never triggers and can mask unexpected values silently. Consider either removing this branch or adding an explicit compatibility comment + logging when an unknown reason is seen so that unexpected metadata values don't get dropped unnoticed.



##########
pinot-core/src/test/java/org/apache/pinot/core/query/distinct/DistinctExecutorTrackingOverheadTest.java:
##########
@@ -0,0 +1,580 @@
+/**
+ * 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.core.query.distinct;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.stream.Collectors;
+import javax.annotation.Nullable;
+import org.apache.pinot.common.request.context.ExpressionContext;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.common.utils.DataSchema.ColumnDataType;
+import org.apache.pinot.core.common.BlockValSet;
+import org.apache.pinot.core.operator.blocks.ValueBlock;
+import org.apache.pinot.core.query.distinct.dictionary.DictionaryBasedMultiColumnDistinctExecutor;
+import org.apache.pinot.core.query.distinct.raw.IntDistinctExecutor;
+import org.apache.pinot.core.query.distinct.raw.RawMultiColumnDistinctExecutor;
+import org.apache.pinot.segment.spi.index.reader.Dictionary;
+import org.apache.pinot.spi.data.FieldSpec.DataType;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+
+
+/**
+ * Micro-benchmark to measure overhead of early-termination tracking vs no tracking.
+ * Runs each path many times and compares elapsed times to ensure tracking does not regress performance.
+ */
+public class DistinctExecutorTrackingOverheadTest {
+
+  private static final int BLOCK_SIZE = 10_000;
+  private static final int NUM_BLOCKS = 50;
+  private static final int NUM_WARMUP = 10;
+  private static final int NUM_ITERATIONS = 20;
+
+  @Test
+  public void testSingleColumnRawExecutorTrackingOverhead() {
+    ExpressionContext expression = ExpressionContext.forIdentifier("c1");
+    int[] values = generateIntValues(BLOCK_SIZE, 5000);
+    ValueBlock block = new SimpleValueBlock(BLOCK_SIZE, Map.of(expression, new IntBlockValSet(values)));
+
+    // Warmup
+    for (int w = 0; w < NUM_WARMUP; w++) {
+      runSingleColumnRaw(expression, block, false);
+      runSingleColumnRaw(expression, block, true);
+    }
+
+    long noTrackTotal = 0;
+    long trackTotal = 0;
+    for (int i = 0; i < NUM_ITERATIONS; i++) {
+      noTrackTotal += runSingleColumnRaw(expression, block, false);
+      trackTotal += runSingleColumnRaw(expression, block, true);
+    }
+
+    double noTrackAvgMs = noTrackTotal / (double) NUM_ITERATIONS / 1_000_000.0;
+    double trackAvgMs = trackTotal / (double) NUM_ITERATIONS / 1_000_000.0;
+    double overheadPct = ((trackAvgMs - noTrackAvgMs) / noTrackAvgMs) * 100;
+
+    System.out.printf("[SingleColumnRaw] No tracking: %.3f ms, With tracking: %.3f ms, Overhead: %.1f%%%n",
+        noTrackAvgMs, trackAvgMs, overheadPct);
+    // Allow up to 20% overhead for the tracking path
+    assertTrue(overheadPct < 20.0,
+        String.format("Tracking overhead %.1f%% exceeds 20%% threshold", overheadPct));
+  }

Review Comment:
   This test asserts a performance threshold based on wall-clock timing (`System.nanoTime()`), which is inherently noisy and can be flaky under CI load/CPU contention. Consider moving this micro-benchmark to the JMH benchmarks in `pinot-perf` (or making it a non-gating benchmark/disabled test), and keep unit tests focused on deterministic functional correctness.



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LeafOperator.java:
##########
@@ -360,6 +360,32 @@ private synchronized void mergeExecutionStats(Map<String, String> executionStats
         case NUM_GROUPS_WARNING_LIMIT_REACHED:
           _statMap.merge(StatKey.NUM_GROUPS_WARNING_LIMIT_REACHED, Boolean.parseBoolean(entry.getValue()));
           break;
+        case EARLY_TERMINATION_REASON:
+          String reasonStr = entry.getValue();
+          try {
+            BaseResultsBlock.EarlyTerminationReason reason = "TIME_LIMIT".equals(reasonStr)
+                ? BaseResultsBlock.EarlyTerminationReason.DISTINCT_TIME_LIMIT
+                : BaseResultsBlock.EarlyTerminationReason.valueOf(reasonStr);
+            switch (reason) {
+              case DISTINCT_MAX_ROWS:
+                _statMap.merge(StatKey.MAX_ROWS_IN_DISTINCT_REACHED, true);
+                break;
+              case DISTINCT_NO_NEW_VALUES:
+                _statMap.merge(StatKey.NUM_ROWS_WITHOUT_CHANGE_IN_DISTINCT_REACHED, true);
+                break;
+              case DISTINCT_TIME_LIMIT:
+                _statMap.merge(StatKey.TIME_LIMIT_IN_DISTINCT_REACHED, true);
+                break;
+              case NONE:
+                break;
+              default:
+                LOGGER.warn("Unknown distinct early termination reason: {}", reasonStr);
+                break;
+            }
+          } catch (IllegalArgumentException e) {
+            LOGGER.warn("Unknown distinct early termination reason: {}", reasonStr);
+          }

Review Comment:
   `EARLY_TERMINATION_REASON` is produced by `BaseResultsBlock` as `EarlyTerminationReason.name()` (e.g. `DISTINCT_TIME_LIMIT`). The special-case mapping of string value `"TIME_LIMIT"` to `DISTINCT_TIME_LIMIT` looks unreachable in this codebase and adds ambiguity. Consider removing it, or add a clear compatibility comment explaining what component still emits `TIME_LIMIT` and why only that legacy value needs translation.



##########
pinot-perf/src/main/java/org/apache/pinot/perf/BenchmarkDistinctQueriesMSQE.java:
##########
@@ -0,0 +1,261 @@
+/**
+ * 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.perf;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import io.grpc.NameResolverRegistry;
+import io.grpc.internal.DnsNameResolverProvider;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.common.utils.TarCompressionUtils;
+import org.apache.pinot.integration.tests.BaseClusterIntegrationTest;
+import org.apache.pinot.integration.tests.ClusterIntegrationTestUtils;
+import org.apache.pinot.segment.local.segment.creator.impl.SegmentIndexCreationDriverImpl;
+import org.apache.pinot.segment.spi.AggregationFunctionType;
+import org.apache.pinot.segment.spi.creator.SegmentGeneratorConfig;
+import org.apache.pinot.segment.spi.index.startree.AggregationFunctionColumnPair;
+import org.apache.pinot.spi.config.table.FieldConfig;
+import org.apache.pinot.spi.config.table.StarTreeIndexConfig;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.data.readers.RecordReader;
+import org.apache.pinot.spi.utils.CommonConstants;
+import org.apache.pinot.spi.utils.NetUtils;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+import org.apache.pinot.util.TestUtils;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+
+/**
+ * Benchmark distinct queries using both single-stage (v1) and multi-stage (v2) query engines.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Fork(1)
+@Warmup(iterations = 5, time = 1)
+@Measurement(iterations = 5, time = 1)
+@State(Scope.Benchmark)
+public class BenchmarkDistinctQueriesMSQE extends BaseClusterIntegrationTest {
+
+  public static void main(String[] args)
+      throws Exception {
+    ChainedOptionsBuilder opt = new OptionsBuilder().include(BenchmarkDistinctQueriesMSQE.class.getSimpleName());
+    new Runner(opt.build()).run();
+  }
+
+  private static final String TABLE_NAME = "MyTable";
+  private static final String FIRST_SEGMENT_NAME = "firstTestSegment";
+  private static final String SECOND_SEGMENT_NAME = "secondTestSegment";
+  private static final String INT_COL_NAME = "INT_COL";
+  private static final String SORTED_COL_NAME = "SORTED_COL";
+  private static final String RAW_INT_COL_NAME = "RAW_INT_COL";
+  private static final String RAW_STRING_COL_NAME = "RAW_STRING_COL";
+  private static final String NO_INDEX_INT_COL_NAME = "NO_INDEX_INT_COL";
+  private static final String NO_INDEX_STRING_COL = "NO_INDEX_STRING_COL";
+  private static final String LOW_CARDINALITY_STRING_COL = "LOW_CARDINALITY_STRING_COL";
+  private static final String TIMESTAMP_COL = "TSTMP_COL";
+  private static final List<FieldConfig> FIELD_CONFIGS = new ArrayList<>();
+  private static final String TRACKING_QUERY_OPTIONS =
+      "maxRowsInDistinct=2000000000;numRowsWithoutChangeInDistinct=2000000000;maxExecutionTimeMsInDistinct=600000";
+
+  private static final TableConfig TABLE_CONFIG = new TableConfigBuilder(TableType.OFFLINE)
+      .setTableName(TABLE_NAME)
+      .setInvertedIndexColumns(List.of(INT_COL_NAME, LOW_CARDINALITY_STRING_COL))
+      .setFieldConfigList(FIELD_CONFIGS)
+      .setNoDictionaryColumns(List.of(RAW_INT_COL_NAME, RAW_STRING_COL_NAME, TIMESTAMP_COL))
+      .setSortedColumn(SORTED_COL_NAME)
+      .setRangeIndexColumns(List.of(INT_COL_NAME, LOW_CARDINALITY_STRING_COL))
+      .setStarTreeIndexConfigs(
+          Collections.singletonList(
+              new StarTreeIndexConfig(List.of(SORTED_COL_NAME, INT_COL_NAME), null,
+                  Collections.singletonList(
+                      new AggregationFunctionColumnPair(AggregationFunctionType.SUM, RAW_INT_COL_NAME).toColumnName()),
+                  null, Integer.MAX_VALUE))).build();
+
+  private static final Schema SCHEMA = new Schema.SchemaBuilder()
+      .setSchemaName(TABLE_NAME)
+      .addSingleValueDimension(SORTED_COL_NAME, FieldSpec.DataType.INT)
+      .addSingleValueDimension(NO_INDEX_INT_COL_NAME, FieldSpec.DataType.INT)
+      .addSingleValueDimension(RAW_INT_COL_NAME, FieldSpec.DataType.INT)
+      .addSingleValueDimension(INT_COL_NAME, FieldSpec.DataType.INT)
+      .addSingleValueDimension(RAW_STRING_COL_NAME, FieldSpec.DataType.STRING)
+      .addSingleValueDimension(NO_INDEX_STRING_COL, FieldSpec.DataType.STRING)
+      .addSingleValueDimension(LOW_CARDINALITY_STRING_COL, FieldSpec.DataType.STRING)
+      .addSingleValueDimension(TIMESTAMP_COL, FieldSpec.DataType.TIMESTAMP)
+      .build();
+
+  public static final String DISTINCT_LOW_CARDINALITY_QUERY =
+      "SELECT DISTINCT LOW_CARDINALITY_STRING_COL FROM MyTable LIMIT 1000";
+  public static final String DISTINCT_INT_QUERY =
+      "SELECT DISTINCT INT_COL FROM MyTable LIMIT 100000";
+  public static final String DISTINCT_RAW_STRING_QUERY =
+      "SELECT DISTINCT RAW_STRING_COL FROM MyTable LIMIT 100000";
+  public static final String DISTINCT_MULTI_COL_QUERY =
+      "SELECT DISTINCT INT_COL, LOW_CARDINALITY_STRING_COL FROM MyTable LIMIT 100000";
+  public static final String DISTINCT_ORDER_BY_QUERY =
+      "SELECT DISTINCT INT_COL FROM MyTable ORDER BY INT_COL DESC LIMIT 100000";
+  public static final String DISTINCT_FILTERED_RAW_STRING_QUERY =
+      "SELECT DISTINCT RAW_STRING_COL FROM MyTable WHERE LOW_CARDINALITY_STRING_COL = 'value1' LIMIT 100000";
+
+  private Distribution.DataSupplier _supplier;
+  private int _brokerQueryRunnerPort;
+  private int _serverQueryServicePort;
+  private int _serverQueryRunnerPort;
+
+  @Param("1500000")
+  private int _numRows;
+
+  @Param({"EXP(0.001)", "EXP(0.5)", "EXP(0.999)"})
+  String _scenario;
+
+  @Param({"enabled", "disabled"})
+  String _trackingMode;
+
+  @Param({"v1", "v2"})
+  String _engine;
+
+  @Param({
+      DISTINCT_LOW_CARDINALITY_QUERY, DISTINCT_INT_QUERY, DISTINCT_RAW_STRING_QUERY, DISTINCT_MULTI_COL_QUERY,
+      DISTINCT_ORDER_BY_QUERY, DISTINCT_FILTERED_RAW_STRING_QUERY
+  })
+  String _query;
+
+  @Setup
+  public void setUp()
+      throws Exception {
+    // Ensure DNS resolver is registered so gRPC can resolve host:port targets in the shaded benchmark jar.
+    NameResolverRegistry.getDefaultRegistry().register(new DnsNameResolverProvider());
+    int basePort = NetUtils.findOpenPort(24000);
+    _brokerQueryRunnerPort = basePort;
+    _serverQueryServicePort = NetUtils.findOpenPort(basePort + 1);
+    _serverQueryRunnerPort = NetUtils.findOpenPort(_serverQueryServicePort + 1);
+    TestUtils.ensureDirectoriesExistAndEmpty(_tempDir, _segmentDir, _tarDir);
+    _supplier = Distribution.createSupplier(42, _scenario);
+
+    // Start the Pinot cluster
+    startZk();
+    startController();
+    startBroker();
+    startServer();
+
+    // upload test data
+    addSchema(SCHEMA);
+    addTableConfig(TABLE_CONFIG);
+
+    buildSegment(FIRST_SEGMENT_NAME);
+    buildSegment(SECOND_SEGMENT_NAME);
+
+    uploadSegments(TABLE_NAME, _tarDir);
+
+    //check for data to arrive
+    waitForAllDocsLoaded(60000);
+  }
+
+  @Override
+  protected long getCountStarResult() {
+    return _numRows * 2;
+  }
+
+  @Override
+  protected Map<String, String> getExtraQueryProperties() {
+    if ("enabled".equals(_trackingMode)) {
+      return Map.of("queryOptions", TRACKING_QUERY_OPTIONS);
+    }
+    return Map.of();
+  }
+
+  @Override
+  protected void overrideBrokerConf(org.apache.pinot.spi.env.PinotConfiguration brokerConf) {
+    brokerConf.setProperty(CommonConstants.MultiStageQueryRunner.KEY_OF_QUERY_RUNNER_PORT, _brokerQueryRunnerPort);
+  }
+
+  @Override
+  protected void overrideServerConf(org.apache.pinot.spi.env.PinotConfiguration serverConf) {
+    serverConf.setProperty(CommonConstants.MultiStageQueryRunner.KEY_OF_QUERY_SERVER_PORT, _serverQueryServicePort);
+    serverConf.setProperty(CommonConstants.MultiStageQueryRunner.KEY_OF_QUERY_RUNNER_PORT, _serverQueryRunnerPort);
+  }
+
+  @TearDown
+  public void tearDown()
+      throws IOException {
+    stopServer();
+    stopBroker();
+    stopController();
+    stopZk();
+    FileUtils.deleteQuietly(_tempDir);
+  }
+
+  @Benchmark
+  public JsonNode query()
+      throws Exception {
+    boolean useMultiStage = "v2".equals(_engine);
+    JsonNode result =
+        postQuery(_query, ClusterIntegrationTestUtils.getBrokerQueryApiUrl(getBrokerBaseApiUrl(), useMultiStage), null,
+            getExtraQueryProperties());
+    JsonNode exceptions = result.get("exceptions").get(0);
+    if (exceptions != null) {
+      throw new RuntimeException(exceptions.get("message").asText());

Review Comment:
   `query()` can throw a NullPointerException when the response doesn't include an `exceptions` array (or it is `null`), because `result.get("exceptions").get(0)` dereferences a potentially-null node. Consider using `result.path("exceptions")` and only indexing when it is an array with `size() > 0` (and the first entry is non-null).
   



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org