Skip to content
Browse files

allows to specify a custom comparator when using slice predicates. as…

…sumes BytesTypes
  • Loading branch information...
1 parent 1edf177 commit cf5726caf83a8cef4cf0853d3298b01746db3c21 @steeve steeve committed with Sep 30, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/java/src/org/apache/cassandra/pig/CassandraStorage.java
View
7 src/java/src/org/apache/cassandra/pig/CassandraStorage.java
@@ -267,10 +267,13 @@ private void setLocationFromUri(String location) throws IOException
if (urlParts.length > 1)
{
Map<String, String> urlQuery = getQueryMap(urlParts[1]);
+ AbstractType comparator = BytesType.instance;
+ if (urlQuery.containsKey("comparator"))
+ comparator = TypeParser.parse(urlQuery.get("comparator"));
if (urlQuery.containsKey("slice_start"))
- slice_start = ByteBufferUtil.bytes(urlQuery.get("slice_start"));
+ slice_start = comparator.fromString(urlQuery.get("slice_start"));
if (urlQuery.containsKey("slice_end"))
- slice_end = ByteBufferUtil.bytes(urlQuery.get("slice_end"));
+ slice_end = comparator.fromString(urlQuery.get("slice_end"));
if (urlQuery.containsKey("reversed"))
slice_reverse = Boolean.parseBoolean(urlQuery.get("reversed"));
if (urlQuery.containsKey("limit"))

0 comments on commit cf5726c

Please sign in to comment.
Something went wrong with that request. Please try again.