[
https://issues.apache.org/jira/browse/PHOENIX-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14247404#comment-14247404
]
Maryann Xue commented on PHOENIX-1533:
--------------------------------------
Think this is actually the cause:
For the above example, we will test different combination of key expressions to
find out a maximize the usage of PK parts. And we return the combination with
the largest number of slot span by calling
"StatementContext.getScanRanges().getPkColumnSpan()".
Unfortunately though, the slot span returned for "(pk0, pk1) in ((?,?), (?,?))"
turned out to be larger than "(pk0, pk1, pk2) in ((?,?, ?), (?,?,?))", so the
"(pk0, pk1)" will eventually be used instead of "(pk0, pk1, pk2)".
And this is further because the key ranges for expression "(pk0, pk1, pk2) in
((?,?,?), (?,?,?))" was decided as a pointLookup at ScanRanges:454, and then
the slot was changed to ScanUtil.SINGLE_COLUMN_SLOT_SPAN at ScanRanges:85.
I suppose we should try to get the raw slot span instead of the final optimized
slot span from pushKeyExpressionsToScan(). Maybe we can add one parameter to
related calls to keep the slot span as it is. Don't know if there are better
ways. [~jamestaylor] Would be great to have your comment.
> Last key part not taken into child/parent optimization
> ------------------------------------------------------
>
> Key: PHOENIX-1533
> URL: https://issues.apache.org/jira/browse/PHOENIX-1533
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0, 4.0.0, 5.0.0
> Reporter: Maryann Xue
> Assignee: Maryann Xue
> Original Estimate: 72h
> Remaining Estimate: 72h
>
> For example we have multiple PK columns (pk0, pk1, pk2) for table A, if we do
> a IN subquery or join query with all PK columns, like:
> select * from A where (pk0, pk1, pk2) IN (select pk0, pk1, pk2 from B);
> The child/parent join optimization is supposed to use the entire PK "(pk0,
> pk1, pk2)" for constructing the dynamic skip-scan filter.
> However it would only use (pk0, pk1) instead, missing the last PK part.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)