nsivabalan opened a new pull request, #12636:
URL: https://github.com/apache/hudi/pull/12636
### Change Logs
Looking up in partition stats index only for indexed cols. We take into
account left and right side of expr and ensure we do lookup if its feasible if
there is a mix of cols indexed and non-indexed.
Lets walk through an example to understand this in detail
c1 = 619sdc or c2 = 100 and c3 = 200
Say this is the filter expression in the query issued and there is no
partition predicate provided
case 1:
when all 3 cols are indexed w/ col stats:
expected col stats lookup expression is
(((('c1_minValue <= 619sdc) AND ('c1_maxValue >= 619sdc)) OR (('c2_minValue
<= 100) AND ('c2_maxValue >= 100))) AND (('c3_minValue <= 200) AND
('c3_maxValue >= 200)))
i.e. all 3 cols will be looked up.
case 2:
only c1 and c2 are indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
since left of AND exp is indexed, we can ignore c3 which is not indexed
(right expr of AND).
we translate to
((('c1_minValue <= 619sdc) AND ('c1_maxValue >= 619sdc)) OR (('c2_minValue
<= 100) AND ('c2_maxValue >= 100)))
and lookup in col stats translated df.
case 3:
only c1 and c3 are indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Among c1 and c2, c2 is not indexed. So, left Expr of (c1 = 619sdc or c2 =
100) is deemed as not indexed. But the right expr of 'c3 = 200' is indexed. and
so, we translate this to
(('c3_minValue <= 200) AND ('c3_maxValue >= 200))
and lookup in col stats translated df.
case 4:
only c2 and c3 are indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Same as case 3
So, we translate it to
(('c3_minValue <= 200) AND ('c3_maxValue >= 200))
and lookup in col stats translated df.
case 5:
only c2 is indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Since either of Or clause is not indexed, we have to bypass looking up in
col stats.
case 6:
only c3 is indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Since either of Or clause is not indexed, we have to bypass looking up in
col stats.
case 7:
only c1 is indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Since either of Or clause is not indexed, we have to bypass looking up in
col stats.
case 8:
only c2 is indexed for filter "c1 = 619sdc or c2 = 100 and c3 = 200":
Since either of Or clause is not indexed, we have to bypass looking up in
col stats.
Whenever we deem as PSI (Partition stats Index) should not be looked up, we
return all partitions without pruning.
### Impact
- Looking up in partition stats index only for indexed cols. Unnecessary
overhead if cut down in partition stats lookup for non indexed files.
### Risk level (write none, low medium or high below)
_If medium or high, explain what verification was done to mitigate the
risks._
### Documentation Update
_Describe any necessary documentation update if there is any new feature,
config, or user-facing change. If not, put "none"._
- _The config description must be updated if new configs are added or the
default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website.
Please create a Jira ticket, attach the
ticket number here and follow the
[instruction](https://hudi.apache.org/contribute/developer-setup#website) to
make
changes to the website._
### Contributor's checklist
- [ ] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
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]