Skip to content

GH-1688 Fix possible incomplete results with service enhaner caching + bulk#1689

Merged
afs merged 1 commit intoapache:mainfrom
Aklakan:se-fixes3
Dec 20, 2022
Merged

GH-1688 Fix possible incomplete results with service enhaner caching + bulk#1689
afs merged 1 commit intoapache:mainfrom
Aklakan:se-fixes3

Conversation

@Aklakan
Copy link
Copy Markdown
Contributor

@Aklakan Aklakan commented Dec 19, 2022

GitHub issue resolved #1688

Pull request Description: Fixes registration of an empty iterator in case a cache hit reveals an empty result set.


  • Tests are included.
  • [ ] Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx or JENA-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

@Aklakan Aklakan marked this pull request as draft December 19, 2022 15:24
*/
@Test
public void testEmptyResultSetContribution() {
String dataStr = String.join(StandardSystemProperty.LINE_SEPARATOR.value(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical but why not "\n"? SPARQL is a web language.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the case that on Windows or Mac a plain "\n" could lead to incorrect formatting when System.out.println-ing?
If you prefer "\n" then I am also fine with it.

@Aklakan Aklakan force-pushed the se-fixes3 branch 3 times, most recently from 7202822 to 0723aff Compare December 19, 2022 21:21
@Aklakan
Copy link
Copy Markdown
Contributor Author

Aklakan commented Dec 19, 2022

Overall this PR should be complete but I'd like @LorenzBuehmann to give this PR a final test himself tomorrow.

@LorenzBuehmann
Copy link
Copy Markdown
Contributor

I can confirm that the issue I spotted yesterday has been resolved when using the PR code. Thanks.

@afs
Copy link
Copy Markdown
Member

afs commented Dec 20, 2022

@LorenzBuehmann - thanks for checking - it's "draft" though.

If in the next 2 hours that changes, I (as release manager) will consider it for 4.7.0. The release testing has already been done, bots have already run on different OS etc - it must be clean.

Aklakan added a commit to Aklakan/jena that referenced this pull request Dec 20, 2022
…lved partial result sets of cache hits are empty
*/
public class VarScopeUtils {

public static Map<Var, Var> reverseVarRenameMap(Collection<Var> vars) {
Copy link
Copy Markdown
Contributor Author

@Aklakan Aklakan Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these methods to the end of the class - probably they can be eventually removed.

// Peek the next binding on the active iterator and verify that it maps to the current
// partition key
while (true) {
if (activeIter.hasNext()) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix of indentation - changed 2 spaces to 4.


// Handling of a null supOp - can that happen?
Set<Var> visibleSubOpVars = OpVars.visibleVars(baseSubOp);
this.visibleSubOpVarsScopedToNorm = VarScopeUtils.normalizeVarScopesGlobal(visibleSubOpVars);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one-liner fixes a scoping issue @LorenzBuehmann found just after he reported that this PR works while trying variants of the query that led to this PR. Instead of cut-off results it may lead to missing columns.

@Aklakan Aklakan marked this pull request as ready for review December 20, 2022 11:58
@afs afs merged commit 979b972 into apache:main Dec 20, 2022
SimonBin pushed a commit to AKSW/jena that referenced this pull request Dec 20, 2022
apacheGH-1688 Fix possible incomplete results with service enhaner caching + bulk

(cherry picked from commit 979b972)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service Enhancer: Cache hits with empty result sets may cut off bulk request results

3 participants