dbwong commented on a change in pull request #463: Phoenix stats Initial Commit
URL: https://github.com/apache/phoenix/pull/463#discussion_r272709000
##########
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:
Done.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services