phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] karanmehta93 commented on a change in pull request #463: Phoenix stats Initial Commit
Date Fri, 05 Apr 2019 00:44:36 GMT
karanmehta93 commented on a change in pull request #463: Phoenix stats Initial Commit
URL: https://github.com/apache/phoenix/pull/463#discussion_r272415207
 
 

 ##########
 File path: phoenix-core/src/test/java/org/apache/phoenix/compile/ScanRangesIntersectTest.java
 ##########
 @@ -58,12 +64,344 @@ private static void assertIntersect(ScanRanges ranges, String lowerRange,
String
             assertEquals(expectedKeys, filter.getSlots().get(0));
         }
     }
-    
+
+    private static byte[] stringToByteArray(String str){
+        return PVarchar.INSTANCE.toBytes(str);
+    }
+
+    private static String ByteArrayToString(byte[] bytes){
+        String literalString = PVarchar.INSTANCE.toStringLiteral(bytes,null);
+        return literalString.substring(1,literalString.length() - 1);
+    }
+
     private static List<KeyRange> points(String... points) {
         List<KeyRange> keys = Lists.newArrayListWithExpectedSize(points.length);
         for (String point : points) {
-            keys.add(KeyRange.getKeyRange(PVarchar.INSTANCE.toBytes(point)));
+            keys.add(KeyRange.getKeyRange(stringToByteArray(point)));
         }
         return keys;
     }
+
+    private static PDatum SIMPLE_CHAR = new PDatum() {
+        @Override
+        public boolean isNullable() {
+            return false;
+        }
+
+        @Override
+        public PDataType getDataType() {
+            return PChar.INSTANCE;
+        }
+
+        @Override
+        public Integer getMaxLength() {
+            return 1;
+        }
+
+        @Override
+        public Integer getScale() {
+            return null;
+        }
+
+        @Override
+        public SortOrder getSortOrder() {
+            return SortOrder.getDefault();
+        }
+    };
+
+    // Does not handle some edge conditions like empty string
+    private String handleScanNextKey(String key) {
+        char lastChar = key.charAt(key.length() - 1);
+        return key.substring(0, key.length() - 1) + String.valueOf((char)(lastChar + 1));
+    }
+
 
 Review comment:
   Can you add tests for `EVERYTHING_RANGE` and `EMPTY_RANGE` as well?

----------------------------------------------------------------
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

Mime
View raw message