Skip to content

Commit 79ef7bf

Browse files
author
Andreas Schwarte
committed
GH #32: Fix evaluation of bound join using VALUES clause
It turned out that query engines interprete the scope of the VALUES differently when it is in the WHERE block or outside. This change fixes the issue by putting the VALUES clause inside the WHERE block, which seems to work on all tested engines.
1 parent 974c915 commit 79ef7bf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/com/fluidops/fedx/util/QueryStringUtil.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,9 @@ public static String selectQueryStringBoundUnion( StatementPattern stmt, List<Bi
310310
*
311311
* <source>
312312
* SELECT ?v ?__index WHERE {
313+
* VALUES (?s ?__index) { (:s1 1) (:s2 2) ... (:sN N) }
313314
* ?s name ?v.
314-
* } VALUES (?s ?__index) { (:s1 1) (:s2 2) ... (:sN N) }
315+
* }
315316
* </source>
316317
*
317318
* @param stmt
@@ -339,14 +340,12 @@ public static String selectQueryStringBoundJoinVALUES(StatementPattern stmt, Lis
339340

340341
res.append(" ?").append(BoundJoinVALUESConversionIteration.INDEX_BINDING_NAME).append(" WHERE {");
341342

342-
res.append( stmtPattern );
343343

344344
// TODO evaluate filter expression remote
345345
// if (filterExpr!=null) {
346346
//
347347
// }
348348

349-
res.append(" }");
350349

351350
// add VALUES clause
352351
res.append(" VALUES (");
@@ -368,6 +367,11 @@ public static String selectQueryStringBoundJoinVALUES(StatementPattern stmt, Lis
368367
res.append("\"").append(index).append("\") ");
369368
index++;
370369
}
370+
371+
res.append(" } ");
372+
373+
res.append(stmtPattern);
374+
371375
res.append(" }");
372376

373377
return res.toString();

0 commit comments

Comments
 (0)