You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/03/18 01:10:24 UTC

[GitHub] [incubator-pinot] fx19880617 opened a new pull request #5163: Optimization for selection only queries: Allow early termination

fx19880617 opened a new pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163
 
 
   In Pinot CombineOpearator,  queries are scheduled with at most 10 threads. For tables with many segments(say 10k), it means each thread will process 1k segments.
   For selection only queries (e.g. select * from myTable limit 10), each thread may collect enough results to return after scan a few segments. There is no means to wait and scan all the segments.
   This is extremely useful for people want to randomly browse a big table from query console clicks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394121884
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
+
+  protected int getNumSegmentDataManagers() {
+    return numSegmentDataManagers;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with ${numSegmentDataManagers} threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    String query = "SELECT column1, column6 FROM testTable";
+    BrokerResponseNative brokerResponse = getBrokerResponseForPqlQuery(query);
+    Assert.assertNotNull(brokerResponse.getSelectionResults());
+    Assert.assertNull(brokerResponse.getResultTable());
+    Assert.assertTrue(brokerResponse.getNumSegmentsMatched() == numSegmentDataManagers);
 
 Review comment:
   I think  this is because that we skipped the rest blocks to merge which don't have those information to be collected.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394543385
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
+
+  protected int getNumSegmentDataManagers() {
+    return numSegmentDataManagers;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with ${numSegmentDataManagers} threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    String query = "SELECT column1, column6 FROM testTable";
+    BrokerResponseNative brokerResponse = getBrokerResponseForPqlQuery(query);
+    Assert.assertNotNull(brokerResponse.getSelectionResults());
+    Assert.assertNull(brokerResponse.getResultTable());
+    Assert.assertTrue(brokerResponse.getNumSegmentsMatched() == numSegmentDataManagers);
 
 Review comment:
   Never mind. Checked the definition. `numSegmentsMatched` are number of segments with non-zero `numDocsScanned`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600390081
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=h1) Report
   > Merging [#5163](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/c81a656aea57ff5ba1abd856ca0f0026d8b5e0ee&el=desc) will **decrease** coverage by `20.84%`.
   > The diff coverage is `62.50%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5163/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #5163       +/-   ##
   =============================================
   - Coverage     66.02%   45.17%   -20.85%     
   =============================================
     Files          1050     1050               
     Lines         54117    54125        +8     
     Branches       8071     8074        +3     
   =============================================
   - Hits          35729    24450    -11279     
   - Misses        15734    27567    +11833     
   + Partials       2654     2108      -546     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rg/apache/pinot/core/operator/CombineOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lT3BlcmF0b3IuamF2YQ==) | `60.82% <62.50%> (-5.47%)` | `0.00 <0.00> (ø)` | |
   | [...ava/org/apache/pinot/spi/data/MetricFieldSpec.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvZGF0YS9NZXRyaWNGaWVsZFNwZWMuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [.../org/apache/pinot/spi/data/DimensionFieldSpec.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvZGF0YS9EaW1lbnNpb25GaWVsZFNwZWMuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [.../org/apache/pinot/spi/data/readers/FileFormat.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvZGF0YS9yZWFkZXJzL0ZpbGVGb3JtYXQuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...va/org/apache/pinot/common/config/FieldConfig.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vY29uZmlnL0ZpZWxkQ29uZmlnLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [.../org/apache/pinot/common/http/MultiGetRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vaHR0cC9NdWx0aUdldFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [.../org/apache/pinot/common/lineage/SegmentGroup.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbGluZWFnZS9TZWdtZW50R3JvdXAuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [.../apache/pinot/spi/utils/retry/BaseRetryPolicy.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdXRpbHMvcmV0cnkvQmFzZVJldHJ5UG9saWN5LmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...apache/pinot/spi/stream/StreamConsumerFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvc3RyZWFtL1N0cmVhbUNvbnN1bWVyRmFjdG9yeS5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...apache/pinot/spi/stream/StreamMessageMetadata.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvc3RyZWFtL1N0cmVhbU1lc3NhZ2VNZXRhZGF0YS5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [556 more](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=footer). Last update [bbaa1d9...5ad1acf](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394074020
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/BaseSingleValueQueriesTest.java
 ##########
 @@ -121,8 +122,14 @@ public void loadSegment()
       throws Exception {
     ImmutableSegment immutableSegment = ImmutableSegmentLoader.load(new File(INDEX_DIR, SEGMENT_NAME), ReadMode.heap);
     _indexSegment = immutableSegment;
-    _segmentDataManagers = Arrays
-        .asList(new ImmutableSegmentDataManager(immutableSegment), new ImmutableSegmentDataManager(immutableSegment));
+    _segmentDataManagers = new ArrayList<>();
+    for (int i = 0; i< getNumSegmentDataManagers(); i++) {
 
 Review comment:
   (nit) please reformat and cache `getNumSegmentDataManagers()`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394580452
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,85 @@
+/**
+ * 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.queries;
+
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.apache.pinot.core.operator.CombineOperator;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+
+  /**
+   * In order to ensure each thread is executing more than 1 segment, this test is against
+   * (2 * MAX_NUM_THREADS_PER_QUERY) segments.
+   */
+  @Override
+  protected int getNumSegmentDataManagers() {
+    return CombineOperator.MAX_NUM_THREADS_PER_QUERY * 2;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with getNumSegmentDataManagers() threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    int numThreadsPerQuery = getNumSegmentDataManagers();
 
 Review comment:
   updated the PR

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600390081
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=h1) Report
   > Merging [#5163](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/c81a656aea57ff5ba1abd856ca0f0026d8b5e0ee&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `94.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5163/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5163      +/-   ##
   ============================================
   - Coverage     66.02%   65.97%   -0.06%     
     Complexity       12       12              
   ============================================
     Files          1050     1050              
     Lines         54117    54112       -5     
     Branches       8071     8067       -4     
   ============================================
   - Hits          35729    35698      -31     
   - Misses        15734    15765      +31     
   + Partials       2654     2649       -5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rg/apache/pinot/core/operator/CombineOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lT3BlcmF0b3IuamF2YQ==) | `65.62% <72.72%> (-0.67%)` | `0.00 <0.00> (ø)` | |
   | [...he/pinot/core/operator/CombineGroupByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lR3JvdXBCeU9wZXJhdG9yLmphdmE=) | `84.44% <100.00%> (+0.74%)` | `0.00 <0.00> (ø)` | |
   | [...t/core/operator/CombineGroupByOrderByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lR3JvdXBCeU9yZGVyQnlPcGVyYXRvci5qYXZh) | `85.32% <100.00%> (+0.63%)` | `0.00 <0.00> (ø)` | |
   | [...g/apache/pinot/core/operator/DocIdSetOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Eb2NJZFNldE9wZXJhdG9yLmphdmE=) | `93.54% <100.00%> (+0.44%)` | `0.00 <0.00> (ø)` | |
   | [...ore/operator/query/AggregationGroupByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbkdyb3VwQnlPcGVyYXRvci5qYXZh) | `95.23% <100.00%> (-0.42%)` | `0.00 <0.00> (ø)` | |
   | [...rator/query/AggregationGroupByOrderByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbkdyb3VwQnlPcmRlckJ5T3BlcmF0b3IuamF2YQ==) | `91.66% <100.00%> (-0.65%)` | `0.00 <0.00> (ø)` | |
   | [...pinot/core/operator/query/AggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbk9wZXJhdG9yLmphdmE=) | `94.44% <100.00%> (-0.56%)` | `0.00 <0.00> (ø)` | |
   | [...ator/query/DictionaryBasedAggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9EaWN0aW9uYXJ5QmFzZWRBZ2dyZWdhdGlvbk9wZXJhdG9yLmphdmE=) | `88.88% <100.00%> (-0.40%)` | `0.00 <0.00> (ø)` | |
   | [...erator/query/MetadataBasedAggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9NZXRhZGF0YUJhc2VkQWdncmVnYXRpb25PcGVyYXRvci5qYXZh) | `87.50% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...not/core/operator/query/SelectionOnlyOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9TZWxlY3Rpb25Pbmx5T3BlcmF0b3IuamF2YQ==) | `97.29% <100.00%> (-0.08%)` | `0.00 <0.00> (ø)` | |
   | ... and [27 more](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=footer). Last update [bbaa1d9...3f568b5](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394553589
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,85 @@
+/**
+ * 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.queries;
+
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.apache.pinot.core.operator.CombineOperator;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+
+  /**
+   * In order to ensure each thread is executing more than 1 segment, this test is against
+   * (2 * MAX_NUM_THREADS_PER_QUERY) segments.
+   */
+  @Override
+  protected int getNumSegmentDataManagers() {
+    return CombineOperator.MAX_NUM_THREADS_PER_QUERY * 2;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with getNumSegmentDataManagers() threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    int numThreadsPerQuery = getNumSegmentDataManagers();
 
 Review comment:
   Cause this test will put instance responses twice in dataTableMap for broker reduce, I will update the parameters to reflect this setup.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600390081
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=h1) Report
   > Merging [#5163](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/bbaa1d9305c2f7ac265b55939fabc3a9a4e12243?src=pr&el=desc) will **decrease** coverage by `21.16%`.
   > The diff coverage is `66.66%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5163/graphs/tree.svg?width=650&token=4ibza2ugkz&height=150&src=pr)](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #5163       +/-   ##
   =============================================
   - Coverage     66.02%   44.85%   -21.17%     
   =============================================
     Files          1050     1050               
     Lines         54117    54125        +8     
     Branches       8071     8074        +3     
   =============================================
   - Hits          35729    24279    -11450     
   - Misses        15734    27745    +12011     
   + Partials       2654     2101      -553
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rg/apache/pinot/core/operator/CombineOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lT3BlcmF0b3IuamF2YQ==) | `60.82% <66.66%> (-5.47%)` | `0 <0> (ø)` | |
   | [.../org/apache/pinot/common/http/MultiGetRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vaHR0cC9NdWx0aUdldFJlcXVlc3QuamF2YQ==) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...che/pinot/common/restlet/resources/TablesList.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcmVzdGxldC9yZXNvdXJjZXMvVGFibGVzTGlzdC5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ransformer/timeunit/CustomTimeUnitTransformer.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vdHJhbnNmb3JtZXIvdGltZXVuaXQvQ3VzdG9tVGltZVVuaXRUcmFuc2Zvcm1lci5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...che/pinot/pql/parsers/pql2/ast/OptionsAstNode.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9wcWwvcGFyc2Vycy9wcWwyL2FzdC9PcHRpb25zQXN0Tm9kZS5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ot/core/query/scheduler/TableBasedGroupMapper.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvVGFibGVCYXNlZEdyb3VwTWFwcGVyLmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...t/core/segment/index/readers/OnHeapDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zZWdtZW50L2luZGV4L3JlYWRlcnMvT25IZWFwRGljdGlvbmFyeS5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [.../apache/pinot/common/config/TagOverrideConfig.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vY29uZmlnL1RhZ092ZXJyaWRlQ29uZmlnLmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...t/core/query/scheduler/OutOfCapacityException.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvT3V0T2ZDYXBhY2l0eUV4Y2VwdGlvbi5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ot/core/query/scheduler/SchedulerQueryContext.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvU2NoZWR1bGVyUXVlcnlDb250ZXh0LmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | ... and [554 more](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=footer). Last update [bbaa1d9...a91e455](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394073717
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
 
 Review comment:
   You can make CombineOperator. MAX_NUM_THREADS_PER_QUERY public to make this test easier to understand.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394071927
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/operator/CombineOperator.java
 ##########
 @@ -196,6 +202,17 @@ public IntermediateResultsBlock callJob()
     return mergedBlock;
   }
 
+  // This will check if IntermediateResultsBlock already satisfying query, so there is no need to continue query processing.
+  private boolean allowEarlyTermination(BrokerRequest brokerRequest, IntermediateResultsBlock mergedBlock) {
 
 Review comment:
   Can we rename this method to something more intuitive? Like `isQuerySatisfied()`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang merged pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang merged pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394073775
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
+
 
 Review comment:
   ```suggestion
   @Override
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] fx19880617 commented on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600850219
 
 
   > @fx19880617 I pushed a commit to address the metadata issue with the early termination. The fixed metadata are: `numSegmentsProcessed` which is the number of segments after the segment pruning; `numTotalDocs` which is the total number of documents for the table. Please take a look
   
   lgtm! 👍 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394074304
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
+
+  protected int getNumSegmentDataManagers() {
+    return numSegmentDataManagers;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with ${numSegmentDataManagers} threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    String query = "SELECT column1, column6 FROM testTable";
+    BrokerResponseNative brokerResponse = getBrokerResponseForPqlQuery(query);
+    Assert.assertNotNull(brokerResponse.getSelectionResults());
+    Assert.assertNull(brokerResponse.getResultTable());
+    Assert.assertTrue(brokerResponse.getNumSegmentsMatched() == numSegmentDataManagers);
 
 Review comment:
   Why does `numSegmentsMatched` also change?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394129498
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.queries;
+
+import java.io.IOException;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+  private int numSegmentDataManagers = Math.max(1, Math.min(10, Runtime.getRuntime().availableProcessors() / 2)) * 2;
+
+  protected int getNumSegmentDataManagers() {
+    return numSegmentDataManagers;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with ${numSegmentDataManagers} threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    String query = "SELECT column1, column6 FROM testTable";
+    BrokerResponseNative brokerResponse = getBrokerResponseForPqlQuery(query);
+    Assert.assertNotNull(brokerResponse.getSelectionResults());
+    Assert.assertNull(brokerResponse.getResultTable());
+    Assert.assertTrue(brokerResponse.getNumSegmentsMatched() == numSegmentDataManagers);
 
 Review comment:
   This is kind of like  a partial results but it's a valid one .

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600837740
 
 
   @fx19880617 I pushed a commit to address the metadata issue with the early termination. The fixed metadata are: `numSegmentsProcessed` which is the number of segments after the segment pruning; `numTotalDocs` which is the total number of documents for the table. Please take a look

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io commented on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600390081
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=h1) Report
   > Merging [#5163](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/bbaa1d9305c2f7ac265b55939fabc3a9a4e12243?src=pr&el=desc) will **decrease** coverage by `20.98%`.
   > The diff coverage is `62.5%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5163/graphs/tree.svg?width=650&token=4ibza2ugkz&height=150&src=pr)](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #5163       +/-   ##
   =============================================
   - Coverage     66.02%   45.03%   -20.99%     
   =============================================
     Files          1050     1050               
     Lines         54117    54125        +8     
     Branches       8071     8074        +3     
   =============================================
   - Hits          35729    24376    -11353     
   - Misses        15734    27628    +11894     
   + Partials       2654     2121      -533
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rg/apache/pinot/core/operator/CombineOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lT3BlcmF0b3IuamF2YQ==) | `60.82% <62.5%> (-5.47%)` | `0 <0> (ø)` | |
   | [.../org/apache/pinot/common/http/MultiGetRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vaHR0cC9NdWx0aUdldFJlcXVlc3QuamF2YQ==) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...che/pinot/common/restlet/resources/TablesList.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcmVzdGxldC9yZXNvdXJjZXMvVGFibGVzTGlzdC5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ransformer/timeunit/CustomTimeUnitTransformer.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vdHJhbnNmb3JtZXIvdGltZXVuaXQvQ3VzdG9tVGltZVVuaXRUcmFuc2Zvcm1lci5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...che/pinot/pql/parsers/pql2/ast/OptionsAstNode.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9wcWwvcGFyc2Vycy9wcWwyL2FzdC9PcHRpb25zQXN0Tm9kZS5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ot/core/query/scheduler/TableBasedGroupMapper.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvVGFibGVCYXNlZEdyb3VwTWFwcGVyLmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...t/core/segment/index/readers/OnHeapDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zZWdtZW50L2luZGV4L3JlYWRlcnMvT25IZWFwRGljdGlvbmFyeS5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [.../apache/pinot/common/config/TagOverrideConfig.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vY29uZmlnL1RhZ092ZXJyaWRlQ29uZmlnLmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...t/core/query/scheduler/OutOfCapacityException.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvT3V0T2ZDYXBhY2l0eUV4Y2VwdGlvbi5qYXZh) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | [...ot/core/query/scheduler/SchedulerQueryContext.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9xdWVyeS9zY2hlZHVsZXIvU2NoZWR1bGVyUXVlcnlDb250ZXh0LmphdmE=) | `0% <0%> (-100%)` | `0% <0%> (ø)` | |
   | ... and [556 more](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=footer). Last update [bbaa1d9...c98b96e](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#issuecomment-600390081
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=h1) Report
   > Merging [#5163](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/c81a656aea57ff5ba1abd856ca0f0026d8b5e0ee&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `94.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5163/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5163      +/-   ##
   ============================================
   - Coverage     66.02%   65.97%   -0.06%     
     Complexity       12       12              
   ============================================
     Files          1050     1050              
     Lines         54117    54112       -5     
     Branches       8071     8067       -4     
   ============================================
   - Hits          35729    35698      -31     
   - Misses        15734    15765      +31     
   + Partials       2654     2649       -5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rg/apache/pinot/core/operator/CombineOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lT3BlcmF0b3IuamF2YQ==) | `65.62% <72.72%> (-0.67%)` | `0.00 <0.00> (ø)` | |
   | [...he/pinot/core/operator/CombineGroupByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lR3JvdXBCeU9wZXJhdG9yLmphdmE=) | `84.44% <100.00%> (+0.74%)` | `0.00 <0.00> (ø)` | |
   | [...t/core/operator/CombineGroupByOrderByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Db21iaW5lR3JvdXBCeU9yZGVyQnlPcGVyYXRvci5qYXZh) | `85.32% <100.00%> (+0.63%)` | `0.00 <0.00> (ø)` | |
   | [...g/apache/pinot/core/operator/DocIdSetOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9Eb2NJZFNldE9wZXJhdG9yLmphdmE=) | `93.54% <100.00%> (+0.44%)` | `0.00 <0.00> (ø)` | |
   | [...ore/operator/query/AggregationGroupByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbkdyb3VwQnlPcGVyYXRvci5qYXZh) | `95.23% <100.00%> (-0.42%)` | `0.00 <0.00> (ø)` | |
   | [...rator/query/AggregationGroupByOrderByOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbkdyb3VwQnlPcmRlckJ5T3BlcmF0b3IuamF2YQ==) | `91.66% <100.00%> (-0.65%)` | `0.00 <0.00> (ø)` | |
   | [...pinot/core/operator/query/AggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9BZ2dyZWdhdGlvbk9wZXJhdG9yLmphdmE=) | `94.44% <100.00%> (-0.56%)` | `0.00 <0.00> (ø)` | |
   | [...ator/query/DictionaryBasedAggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9EaWN0aW9uYXJ5QmFzZWRBZ2dyZWdhdGlvbk9wZXJhdG9yLmphdmE=) | `88.88% <100.00%> (-0.40%)` | `0.00 <0.00> (ø)` | |
   | [...erator/query/MetadataBasedAggregationOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9NZXRhZGF0YUJhc2VkQWdncmVnYXRpb25PcGVyYXRvci5qYXZh) | `87.50% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...not/core/operator/query/SelectionOnlyOperator.java](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9xdWVyeS9TZWxlY3Rpb25Pbmx5T3BlcmF0b3IuamF2YQ==) | `97.29% <100.00%> (-0.08%)` | `0.00 <0.00> (ø)` | |
   | ... and [27 more](https://codecov.io/gh/apache/incubator-pinot/pull/5163/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=footer). Last update [bbaa1d9...3f568b5](https://codecov.io/gh/apache/incubator-pinot/pull/5163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #5163: Optimization for selection only queries: Allow early termination
URL: https://github.com/apache/incubator-pinot/pull/5163#discussion_r394543814
 
 

 ##########
 File path: pinot-core/src/test/java/org/apache/pinot/queries/SelectionOnlyEarlyTerminationTest.java
 ##########
 @@ -0,0 +1,85 @@
+/**
+ * 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.queries;
+
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.apache.pinot.core.operator.CombineOperator;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests selection only queries
+ */
+public class SelectionOnlyEarlyTerminationTest extends BaseSingleValueQueriesTest {
+
+  /**
+   * In order to ensure each thread is executing more than 1 segment, this test is against
+   * (2 * MAX_NUM_THREADS_PER_QUERY) segments.
+   */
+  @Override
+  protected int getNumSegmentDataManagers() {
+    return CombineOperator.MAX_NUM_THREADS_PER_QUERY * 2;
+  }
+
+  /**
+   * With early termination, Selection Only query is scheduled with getNumSegmentDataManagers() threads,
+   * total segment processed is same at num threads.
+   */
+  @Test
+  public void testSelectOnlyQuery() {
+    int numThreadsPerQuery = getNumSegmentDataManagers();
 
 Review comment:
   Why `numThreadsPerQuery` != `CombineOperator.MAX_NUM_THREADS_PER_QUERY`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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