You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/04/08 19:42:08 UTC
[GitHub] [druid] himanshug commented on a change in pull request #9634: More
optimize CNF conversion of filters
himanshug commented on a change in pull request #9634: More optimize CNF conversion of filters
URL: https://github.com/apache/druid/pull/9634#discussion_r405769028
##########
File path: processing/src/main/java/org/apache/druid/segment/filter/Filters.java
##########
@@ -426,175 +424,21 @@ public static Filter convertToCNFFromQueryContext(Query query, @Nullable Filter
return null;
}
boolean useCNF = query.getContextBoolean(CTX_KEY_USE_FILTER_CNF, false);
- return useCNF ? toCNF(filter) : filter;
+ return useCNF ? Filters.toCnf(filter) : filter;
}
- public static Filter toCNF(Filter current)
+ public static Filter toCnf(Filter current)
{
- current = pushDownNot(current);
- current = flatten(current);
- current = convertToCNFInternal(current);
- current = flatten(current);
+ current = HiveCnfHelper.pushDownNot(current);
+ current = HiveCnfHelper.flatten(current);
+ // Pull out AND filters first to convert the filter into a conjunctive form.
+ // This is important to not create a huge CNF.
+ current = CalciteCnfHelper.pull(current);
+ current = HiveCnfHelper.convertToCNFInternal(current);
+ current = HiveCnfHelper.flatten(current);
Review comment:
It would be nice to add some commentary on each line describing (possibly with example) why it exists. I know there is something in PR description but this is non-trivial.
----------------------------------------------------------------
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org