You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2019/06/26 05:39:00 UTC
[jira] [Commented] (PHOENIX-5176)
KeyRange.compareUpperRange(KeyRang 1, KeyRang 2) returns wrong result when
two key ranges have the same upper bound values but one is inclusive and
another is exclusive
[ https://issues.apache.org/jira/browse/PHOENIX-5176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16872938#comment-16872938 ]
Lars Hofhansl commented on PHOENIX-5176:
----------------------------------------
Ping. Commit or I'll push it to the next point release.
> KeyRange.compareUpperRange(KeyRang 1, KeyRang 2) returns wrong result when two key ranges have the same upper bound values but one is inclusive and another is exclusive
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-5176
> URL: https://issues.apache.org/jira/browse/PHOENIX-5176
> Project: Phoenix
> Issue Type: Bug
> Reporter: Bin Shi
> Assignee: Bin Shi
> Priority: Blocker
> Fix For: 4.15.0
>
> Time Spent: 4h
> Remaining Estimate: 0h
>
> In KeyRange.java,
> {color:#262626} public static int compareUpperRange(KeyRange rowKeyRange1, KeyRange rowKeyRange2) {{color}
> {color:#262626} int result = Boolean.compare(rowKeyRange1.upperUnbound(), rowKeyRange2.upperUnbound());{color}
> {color:#262626} if (result != 0) {{color}
> {color:#262626} return result;{color}
> {color:#262626} }{color}
> {color:#262626} result = Bytes.BYTES_COMPARATOR.compare(rowKeyRange1.getUpperRange(), rowKeyRange2.getUpperRange());{color}
> {color:#262626} if (result != 0) {{color}
> {color:#262626} return result;{color}
> {color:#262626} }{color}
> {color:#262626} return Boolean.compare(*rowKeyRange2*.isUpperInclusive(), *rowKeyRange1*.isUpperInclusive());{color}
> {color:#262626} }{color}
> {color:#262626} {color}
> {color:#262626}The last line in yellow color should be "{color}return Boolean.compare(*rowKeyRange1*.isUpperInclusive(), *rowKeyRange2*.isUpperInclusive());". Given rowKeyRange1 [3, 5) and rowKeyRange2 [3, 5], the function should return -1, but now it returns 1 due to the bug I mentioned.
>
> The KeyRange.compareUpperRange is only used in KeyRange.intersect(List<KeyRange> rowKeyRanges1, List<KeyRange> rowKeyRanges2). Given rowKeyRanges1 \{[3, 5), [5, 6)} and rowKeyRanges2\{[3, 5], [6, 7]}, the function should return \{[3, 5), [5, 5]}, i.e., \{[3, 5]}, but it seems that now it returns \{[3,5)} due to the bug.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)