ankitsultana commented on code in PR #10270:
URL: https://github.com/apache/pinot/pull/10270#discussion_r1108914529


##########
pinot-core/src/main/java/org/apache/pinot/core/query/pruner/PartitionsSegmentPruner.java:
##########
@@ -0,0 +1,82 @@
+/**
+ * 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.pruner;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.pinot.core.query.request.context.QueryContext;
+import org.apache.pinot.segment.spi.ColumnMetadata;
+import org.apache.pinot.segment.spi.IndexSegment;
+import org.apache.pinot.segment.spi.SegmentMetadata;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * The {@code PartitionSegmentPruner} is the segment pruner that prunes 
segments based on the partition info from the
+ * QueryContext.
+ */
+public class PartitionsSegmentPruner implements SegmentPruner {
+
+  @Override
+  public void init(PinotConfiguration config) {
+  }
+
+  @Override
+  public boolean isApplicableTo(QueryContext query) {
+    return query.getColumnPartitionMap() != null && 
!query.getColumnPartitionMap().isEmpty();
+  }
+
+  @Override
+  public List<IndexSegment> prune(List<IndexSegment> segments, QueryContext 
query) {

Review Comment:
   There are some caveats with using columnPartitionMap with multiple columns 
with realtime tables. If there's only 1 column in 
TableConfig::segmentPartitionConfig then a consuming segment assumes the 
partition for the configured column to be the same as the Kafka partition.
   
   If there is more than 1 column, then the columnPartitionMap for the segment 
is not set until the segment is committed.
   
   I think this pruner would always skip consuming segments when there's more 
than 1 column in the TableConfig::segmentPartitionConfig. Can you confirm?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to