RYA-469 Update join var end marker value. Closes #285

Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/b6c94e41
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/b6c94e41
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/b6c94e41

Branch: refs/heads/master
Commit: b6c94e41e4b16a9f672efae4175b806ca1f9044b
Parents: f3eb541
Author: eric.white <eric.wh...@parsons.com>
Authored: Mon Apr 2 11:37:21 2018 -0400
Committer: Valiyil <puja.vali...@parsons.com>
Committed: Fri Apr 6 11:59:57 2018 -0400

----------------------------------------------------------------------
 .../rya/streams/client/command/RunQueryCommandIT.java |  2 +-
 .../kafka/processors/join/KeyValueJoinStateStore.java | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b6c94e41/extras/rya.streams/client/src/test/java/org/apache/rya/streams/client/command/RunQueryCommandIT.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.streams/client/src/test/java/org/apache/rya/streams/client/command/RunQueryCommandIT.java
 
b/extras/rya.streams/client/src/test/java/org/apache/rya/streams/client/command/RunQueryCommandIT.java
index 03834e9..6df7a3d 100644
--- 
a/extras/rya.streams/client/src/test/java/org/apache/rya/streams/client/command/RunQueryCommandIT.java
+++ 
b/extras/rya.streams/client/src/test/java/org/apache/rya/streams/client/command/RunQueryCommandIT.java
@@ -206,7 +206,7 @@ public class RunQueryCommandIT {
 
     @Test
     public void runQueryFromFile() throws Exception {
-        // NOTE: the order of the query statements previously lead to join
+        // NOTE: the order of the query statements previously led to join
         // issues. When "lubm:undergraduateDegreeFrom" was the first statement
         // in the where clause (as opposed to the last) the
         // KeyValueJoinStateStore blew up.

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b6c94e41/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/join/KeyValueJoinStateStore.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/join/KeyValueJoinStateStore.java
 
b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/join/KeyValueJoinStateStore.java
index 8df77c4..61ca141 100644
--- 
a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/join/KeyValueJoinStateStore.java
+++ 
b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/join/KeyValueJoinStateStore.java
@@ -53,12 +53,14 @@ import edu.umd.cs.findbugs.annotations.NonNull;
  * next to each other within the store. This isn't enough information to fetch 
that group, though. We must provide a
  * start and end key to bound the range that is fetched back. To accomplish 
this, we place a start of range marker
  * as the first key for all unique [side]/[join values] groups, and an end of 
range marker as the last key for each
- * of those groups.
+ * of those groups. All keys in between the start and end markers separate 
their
+ * [joinVars] from their [remainingBindingValues] with the join variable end
+ * marker, {@link #JOIN_VAR_END_MARKER}.
  * </p>
  * The rows follow this pattern:
  * <pre>
  * [side],[joinVar1 value], [joinVar2 value], ..., [joinVarN value]0x00
- * [side],[joinVar1 value], [joinVar2 value], ..., [joinVarN 
value],[remainingBindingValues]
+ * [side],[joinVar1 value], [joinVar2 value], ..., [joinVarN 
value][JOIN_VAR_END_MARKER],[remainingBindingValues]
  * [side],[joinVar1 value], [joinVar2 value], ..., [joinVarN value]0xFF
  * </pre>
  * </p>
@@ -80,9 +82,10 @@ public class KeyValueJoinStateStore implements 
JoinStateStore {
     private static final String END_RANGE_SUFFIX = new String(new byte[] { 
(byte) 0xFF }, Charsets.UTF_8);
 
     /**
-     * Indicates where the end of the join variables occurs.
+     * Indicates where the end of the join variables occurs and the start of
+     * the remaining binding values should begin.
      */
-    private static final String JOIN_VAR_END_MARKER = new 
String("~!^~".getBytes(Charsets.UTF_8), Charsets.UTF_8);
+    private static final String JOIN_VAR_END_MARKER = new String(new byte[] { 
(byte) 0x06, (byte) 0x10, (byte) 0x03, (byte) 0x04}, Charsets.UTF_8);
 
     /**
      * A default empty value that is stored for a start of range or end of 
range marker.
@@ -275,7 +278,8 @@ public class KeyValueJoinStateStore implements 
JoinStateStore {
                 // before the remaining "allVars")
                 // A marker is needed to indicate where the join vars end so
                 // that a range search from "urn:Student9[0x00]" to 
"urn:Student9[0xFF]"
-                // does not return "urn:Student95,[remainingBindingValues]".
+                // does not return "urn:Student95,[remainingBindingValues]"
+                // when we want "urn:Student9,[remainingBindingValues]".
                 value += JOIN_VAR_END_MARKER;
             }
             values.add(value);

Reply via email to