You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "stoty (via GitHub)" <gi...@apache.org> on 2023/08/31 13:46:03 UTC
[GitHub] [phoenix] stoty commented on a diff in pull request #1663: PHOENIX-6960 Scan range is incorrect when query desc columns (WIP)
stoty commented on code in PR #1663:
URL: https://github.com/apache/phoenix/pull/1663#discussion_r1311658266
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java:
##########
@@ -1722,7 +1725,10 @@ public KeySlots visitLeave(LikeExpression node, List<KeySlots> childParts) {
lowerRange = Arrays.copyOf(lowerRange, lowerRange.length+1);
lowerRange[lowerRange.length-1] = QueryConstants.SEPARATOR_BYTE;
}
- KeyRange range = type.getKeyRange(lowerRange, true, upperRange, false, SortOrder.ASC);
+ boolean lowerInclusive = column.getSortOrder() == SortOrder.ASC;
+ boolean upperInclusive = column.getSortOrder() == SortOrder.DESC;
+ KeyRange range = type.getKeyRange(lowerRange, lowerInclusive, upperRange,
+ upperInclusive, SortOrder.ASC);
Review Comment:
I have debugged into this, and after inverting twice, we end up returning a non-inverted range, which eventually gets inverted in WhereOptimizer.pushKeyExpressionsToScan().
Do we even need to take SortOrder into account here, and if yes, couldn't we simplify this logic ?
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org