siddharthteotia commented on a change in pull request #6776:
URL: https://github.com/apache/incubator-pinot/pull/6776#discussion_r611820867
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/pruner/ColumnValueSegmentPruner.java
##########
@@ -238,6 +238,49 @@ private boolean pruneRangePredicate(IndexSegment segment,
RangePredicate rangePr
return false;
}
+ /**
+ * For IN predicate, prune the segment based on:
+ * <ul>
+ * <li>Column min/max value</li>
+ * </ul>
+ */
+ private boolean pruneInPredicate(IndexSegment segment, InPredicate
inPredicate, Map<String, DataSource> dataSourceCache) {
+ String column = inPredicate.getLhs().getIdentifier();
+ DataSource dataSource = dataSourceCache.computeIfAbsent(column,
segment::getDataSource);
+ // NOTE: Column must exist after DataSchemaSegmentPruner
+ assert dataSource != null;
+ DataSourceMetadata dataSourceMetadata = dataSource.getDataSourceMetadata();
+ List<String> values = inPredicate.getValues();
+ //set max threshold value
+ if (values.size() > _inPredicateThreshold) {
+ return false;
+ }
+
+ for (String value : values) {
+ Comparable inValue = convertValue(value,
dataSourceMetadata.getDataType());
+ if (!checkMinMaxRange(dataSourceMetadata, inValue)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean checkMinMaxRange(DataSourceMetadata dataSourceMetadata,
Comparable value) {
Review comment:
(nit) please add brief javadoc
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]