Qifan Chen has posted comments on this change. ( http://gerrit.cloudera.org:8080/18023 )
Change subject: IMPALA-7942: Add query hints for cardinalities and selectivities ...................................................................... Patch Set 6: (3 comments) http://gerrit.cloudera.org:8080/#/c/18023/3//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/18023/3//COMMIT_MSG@24 PS3, Line 24: * InPredicate > Sorry, I don't understand, can you explain this? I meant to say in primitive form. http://gerrit.cloudera.org:8080/#/c/18023/3//COMMIT_MSG@49 PS3, Line 49: ' with two 'BinaryPredicate', if : set hint > Thanks for advice, Qifan. I also consider about this, but here are some pro Thanks a lot for the research. It is great. It seems the data representation of the conjuncts when PlanNode.computeCombinedSelectivity() is called can be the following. 1. Conjuncts: as a list of primitive predicates. select * from functional.alltypes where int_col > 1 and smallint_col > 3 2904 E1213 10:09:09.713835 2970698 PlanNode.java:648] 294617a1c2347b6c:c5b2d79400000000] computeCombinedSelectivity(): conjuncts= BinaryPredicate{op=>, exprid=0 SlotRef{label=int_col, path=int_col, type=INT, id=4} NumericLiteral{value=1, type=INT}} BinaryPredicate{op=>, exprid=1 SlotRef{label=smallint_col, path=smallint_col, type=SMALLINT, id=3} NumericLiteral{value=3, type=SMALLINT}} 2. Disjuncts: A list of single CompoundPredicate with nesting. select * from functional.alltypes where int_col > 1 or smallint_col > 3 or int_col > 10 or smallint_col < 30 CompoundPredicate{op=OR, exprid=0 CompoundPredicate{op=OR, CompoundPredicate{op=OR, BinaryPredicate{op=>, SlotRef{label=int_col, path=int_col, type=INT, id=4} NumericLiteral{value=1, type=INT}} BinaryPredicate{op=>, SlotRef{label=smallint_col, path=smallint_col, type=SMALLINT, id=3} NumericLiteral{value=3, type=SMALLINT}} } BinaryPredicate{op=>, SlotRef{label=int_col, path=int_col, type=INT, id=4} NumericLiteral{value=10, type=INT}} } BinaryPredicate{op=<, SlotRef{label=smallint_col, path=smallint_col, type=SMALLINT, id=3} NumericLiteral{value=30, type=SMALLINT}} } Since the selectivity hint is already represented at Predicate, maybe we could handle a subset of complex expressions where a single complex expression C is represented as a single item (as shown in case 2 above). In this case, we just return the value from the hint directly in stead of performing the computation in PlanNode.computeCombinedSelectivity(). When we receive a list of conjunct predicates (as shown in case 1 above) with a hint, I do not have a good answer on mapping the list back to the hint. Maybe we can make use of CompoundPredicate() which can deal with AND by design? On 'shift/reduce conflicts', I wonder how we deal with it for the case (a >1) /* +selectivity 0.4 */. http://gerrit.cloudera.org:8080/#/c/18023/3//COMMIT_MSG@51 PS3, Line 51: value for two 'BinaryPredicate' children. : : Testing: : - Added new fe tests in 'PlannerTest' > I understand, this computing maybe not perfect. But if we set selectivity f See my comment on complex predicates above. -- To view, visit http://gerrit.cloudera.org:8080/18023 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I2776b9bbd878b8a21d9c866b400140a454f59e1b Gerrit-Change-Number: 18023 Gerrit-PatchSet: 6 Gerrit-Owner: wangsheng <[email protected]> Gerrit-Reviewer: Amogh Margoor <[email protected]> Gerrit-Reviewer: Fucun Chu <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Qifan Chen <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]> Gerrit-Reviewer: wangsheng <[email protected]> Gerrit-Comment-Date: Mon, 13 Dec 2021 15:59:54 +0000 Gerrit-HasComments: Yes
