You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2019/06/07 18:03:07 UTC

[GitHub] [phoenix] twdsilva commented on a change in pull request #515: PHOENIX-5318 Slots passed to SkipScan filter is incorrect for desc pr…

twdsilva commented on a change in pull request #515: PHOENIX-5318 Slots passed to SkipScan filter is incorrect for desc pr…
URL: https://github.com/apache/phoenix/pull/515#discussion_r291697101
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/query/KeyRange.java
 ##########
 @@ -108,6 +109,34 @@ public KeyRange apply(byte[] input) {
         }
     };
 
 
 Review comment:
   @dbwong  ```KeyRange.COMPARATOR.reversed()``` will not give the correct behavior. 
   
   For eg for the query Where COL1='1' OR COL1='12' OR COL1='2'
   the key range before sorting is
   
   ```
   0 = {KeyRange@8864} "\xCE" -> "1"
   1 = {KeyRange@8865} "\xCE\xCD" -> "12" 
   2 = {KeyRange@8866} "\xCD" -> "2"
   ```
   
   Sorting using  ```KeyRange.COMPARATOR``` gives the following which isn't correct.
   ```
   0 = {KeyRange@8879} "\xCD" -> "2"
   1 = {KeyRange@8880} "\xCE" -> "1"
   2 = {KeyRange@8881} "\xCE\xCD" -> "12"
   ```
   Using ```KeyRange.COMPARATOR.reverse()``` just reverses the following order which isn't correct.
   
   We need "12" to sort before "1" as thats how its stored on disk. Using ```DescVarLengthFastByteComparisons``` gives  the correct ordering:
   ```
   0 = {KeyRange@8899} "\xCD" -> "2"
   1 = {KeyRange@8900} "\xCE\xCD" -> "12
   2 = {KeyRange@8901} "\xCE" -> "1"
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services