Aklakan commented on code in PR #3517:
URL: https://github.com/apache/jena/pull/3517#discussion_r2442490931


##########
jena-arq/src/main/java/org/apache/jena/sparql/engine/join/MultiHashProbeTable.java:
##########
@@ -180,9 +176,13 @@ public Iterator<Binding> getCandidates(Binding row) {
      *  This method is package private so that it can be called from tests.
      */
     void doFinalize() {
-        // Note: We need to stick with the variable order provided in the 
initial index -> don't sort!
+        // If an initial join key is given then its variables are prepended to 
seen vars
+        // so that those correspond to the first bits of the bit keys!
+        // This means we need to stick with the variable order provided in the 
initial index
+        // -> don't sort!
         // Arrays.sort(seenVars, (a, b) -> a.getName().compareTo(b.getName()));
-        seenVarsJoinKey = JoinKey.create(seenVarSet);
+        seenVarsJoinKey = JoinKey.newBuilder()
+            .addAll(initialIndex.getSuperJoinKey()).addAll(seenVarSet).build();

Review Comment:
   Separated the set of initial variables from the set of variables encountered 
in the build phase - so that clear() can just clear the latter.
   
   To recap: The initial variables are obtained from peeking the first bindings 
of the lhs and rhs and used to create the initial index that holds all the 
bindings. Later indexes are only created on-demand in the streaming phase based 
on which variables are unbound in the streamed bindings.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to