jasperjiaguo commented on code in PR #9420:
URL: https://github.com/apache/pinot/pull/9420#discussion_r977172550


##########
pinot-core/src/test/java/org/apache/pinot/queries/ScanBasedANDFilterReorderingTest.java:
##########
@@ -0,0 +1,89 @@
+/**
+ * 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.util.List;
+import java.util.Map;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.core.operator.BaseOperator;
+import org.apache.pinot.core.operator.ExecutionStatistics;
+import org.apache.pinot.core.operator.blocks.results.SelectionResultsBlock;
+import org.apache.pinot.spi.utils.CommonConstants.Query.OptimizationSwitches;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+
+public class ScanBasedANDFilterReorderingTest extends 
InnerSegmentSelectionSingleValueQueriesTest {
+  private static final String SELECT_STAR_QUERY = "SELECT * FROM testTable";

Review Comment:
   > The underlying assumption for this optimization is that filter for high 
cardinality column usually has higher selectivity. This assumption can hold 
only when the filter is not range. Should we consider re-ordering the scan 
iterators during the actual scan because at that time we know the selectivity 
for each filter (base on how many docs skipped)
   
   Good point. I updated the code to take care of this. Now it re-orders only 
for (not)eq, (not)in. The ranking behavior is the approximation of
   
org.apache.pinot.controller.recommender.rules.utils.QueryInvertedSortedIndexRecommender#percentSelected.
 Basically assume a even distribution of values. Will come up with a valid 
testcase for this code later.



-- 
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