Aklakan commented on code in PR #2413:
URL: https://github.com/apache/jena/pull/2413#discussion_r1571150812
##########
jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java:
##########
@@ -351,9 +389,26 @@ public void visit(OpProject opProject) {
assignMentions.addAll(subUsage.assignMentions);
}
+
@Override
public void visit(OpTable opTable) {
- defines.addAll(opTable.getTable().getVars());
+ Table table = opTable.getTable();
+ Set<Var> definedVars = new HashSet<>(table.getVars());
+ List<Var> optVars = new ArrayList<>();
+ Iterator<Binding> rowIt = table.rows();
+ while (rowIt.hasNext()) {
+ Binding row = rowIt.next();
+ Iterator<Var> varIt = definedVars.iterator();
+ while (varIt.hasNext()) {
+ Var var = varIt.next();
+ if (!row.contains(var)) {
+ varIt.remove();
Review Comment:
I renamed some variables and added comments in the hope that in the future
it can still be understood.
--
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]