1010 *******************************************************************************/
1111package org .eclipse .rdf4j .federated .evaluation .iterator ;
1212
13- import java .util .HashSet ;
14- import java .util .Iterator ;
1513import java .util .List ;
1614import java .util .ListIterator ;
17- import java .util .Set ;
1815
16+ import org .eclipse .collections .impl .set .mutable .primitive .IntHashSet ;
1917import org .eclipse .rdf4j .common .iteration .CloseableIteration ;
2018import org .eclipse .rdf4j .common .iteration .LookAheadIteration ;
19+ import org .eclipse .rdf4j .model .Literal ;
2120import org .eclipse .rdf4j .query .Binding ;
2221import org .eclipse .rdf4j .query .BindingSet ;
2322import org .eclipse .rdf4j .query .QueryEvaluationException ;
@@ -42,7 +41,7 @@ public class BindLeftJoinIteration extends LookAheadIteration<BindingSet> {
4241 protected final CloseableIteration <BindingSet > iter ;
4342 protected final List <BindingSet > bindings ;
4443
45- protected Set < Integer > seenBindingIndexes = new HashSet <> ();
44+ protected IntHashSet seenBindingIndexes = new IntHashSet ();
4645 protected final ListIterator <BindingSet > bindingsIterator ;
4746
4847 public BindLeftJoinIteration (CloseableIteration <BindingSet > iter ,
@@ -57,8 +56,7 @@ protected BindingSet getNextElement() {
5756
5857 if (iter .hasNext ()) {
5958 var bIn = iter .next ();
60- int bIndex = Integer .parseInt (
61- bIn .getBinding (BoundJoinVALUESConversionIteration .INDEX_BINDING_NAME ).getValue ().stringValue ());
59+ int bIndex = ((Literal ) bIn .getValue (BoundJoinVALUESConversionIteration .INDEX_BINDING_NAME )).intValue ();
6260 seenBindingIndexes .add (bIndex );
6361 return convert (bIn , bIndex );
6462 }
@@ -82,9 +80,7 @@ protected void handleClose() {
8280
8381 protected BindingSet convert (BindingSet bIn , int bIndex ) throws QueryEvaluationException {
8482 QueryBindingSet res = new QueryBindingSet ();
85- Iterator <Binding > bIter = bIn .iterator ();
86- while (bIter .hasNext ()) {
87- Binding b = bIter .next ();
83+ for (Binding b : bIn ) {
8884 if (b .getName ().equals (BoundJoinVALUESConversionIteration .INDEX_BINDING_NAME )) {
8985 continue ;
9086 }
0 commit comments