HIVE-23006 ProbeDecode compiler support#952
Conversation
jcamachor
left a comment
There was a problem hiding this comment.
I started taking a look at your patch as well as code in master.
I believe following approach would be easier since you could rely on existing SJ logic.
You could modify method removeSemijoinsParallelToMapJoin in TezCompiler. In particular, findParallelSemiJoinBranch already finds all semijoins originating in a MapJoin input (note that you may need small modification in this block to not skip adding them to the map). After calling that method, semijoins will contain pairs (RS, TS). You will enter this block if TEZ_DYNAMIC_SEMIJOIN_REDUCTION_FOR_MAPJOIN is true (note that you have to remove this condition from L1450). Else, if HIVE_MAPJOIN_PROBEDECODE_ENABLED is true, you will need to remove the SJs (same as the block is doing) and create your optimization data structures, i.e., your context in the TS as you are currently doing. You may end up with multiple MJ targeting a single TS; you can generate a context for each of them, store these in the TS, and decide later on a strategy to apply the filtering based on a config parameter. Let me know if this makes sense.
Cc @t3rmin4t0r
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ProbeDecodeOptimizer.java
Outdated
Show resolved
Hide resolved
Hey @jcamachor , thanks for the comments! I believe the TEZ_DYNAMIC_SEMIJOIN_REDUCTION_FOR_MAPJOIN flag should be false for semijoin removal to kick in (if true the whole method returned in the clean version) The idea of storing multiple MJ targets as part of a TS also makes sense to me -- I guess the decision could be part of GenTezUtils or earlier optimisation rules -- what do you think? https://github.com/apache/hive/pull/952/files#diff-4a039ee6b13e42df6ff51e85db691132R199 PS: Was also thinking that the naming of this is a bit off (HIVE_MAPJOIN_PROBEDECODE) -- as this can also be used for static expression. |
|
@pgaref , thanks for changes. Patch looks good. About the name, I think it is fine (probe side for the filtering generated statically in case of expressions or dynamically for joins). I think main remaining issue is related to selection in case of multiple MJ operators. I was thinking that for the time being, we could make the policy pluggable via config and have two very simple ones: 1) keep the one with lowest You have the information about the stats in the operators themselves (follow |
@jcamachor thanks for the review, I appreciate it! Please check the latest changes with:
Thoughts? My last concern is some operators like VectorPTFEvaluatorDecimalAvg that do not allow the use of Selected (which is what probedecode is doing) and whether we should take that into account as part of the optimizations. |
ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java
Show resolved
Hide resolved
…MapJoin in semijoinRemovalBasedTransformations. TODO: make sure to add some logic (maybe configurable) deciding which TS filtering to select when we have multiple.
Extend TezCompiler to use configurable logic to select a MJ when we have multiple per TS -- currently picking the one with the lowest MJ/TS key Ratio. Making sure that SharedWork TS does not contain a probeContext as it would result in wrong results. Extending TSDesc to include probeContext as part of the explained plan. Change-Id: I90f5ebd8e4f90990c17f89ef75af39bc335f8e7c
Change-Id: I995ba97355ab1a29bf2e23f21ab641cffba19ce3
Change-Id: If67f3d29c727f887cc2cf11c29ea855c6ea315d7
This patch adds an extra optimisation step with the goal of finding Table Scan operators that could reduce the number of rows decoded at runtime using extra available information.
It currently looks for all the available MapJoin operators that could use the smaller HashTable on the probing side (where TS is) to filter-out rows that would never match.
To do so the HashTable information is pushed down to the TS properties and then propagated as part of MapWork.
If the a single TS is used by multiple operators (shared-word), this rule can not be applied.