-
Notifications
You must be signed in to change notification settings - Fork 97
Fix language filter with UPDATE #2461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2461 +/- ##
==========================================
- Coverage 91.47% 91.04% -0.43%
==========================================
Files 466 466
Lines 47158 39479 -7679
Branches 5260 5268 +8
==========================================
- Hits 43137 35943 -7194
+ Misses 2520 2031 -489
- Partials 1501 1505 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
joka921
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A first round of 1-1 reviews.
| if (loadInternalPermutation) { | ||
| setMetadata(permutation.internalPermutation()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done directly by the permutation (if the permutation has an internal permutation, then it also registers that internal perm with the delta triples.
src/index/IndexImpl.cpp
Outdated
| // `Permutation`class, but we first have to deal with The delta triples for | ||
| // the additional permutations. | ||
| // The setting of the metadata doesn't affect the contents of the delta | ||
| // triples, so we don't need to call `writeToDisk`, therefore the second | ||
| // argument to `modify` is `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of this comment should be kept.
| using LocatedTriplesPerBlockAllPermutations = | ||
| std::array<LocatedTriplesPerBlock, Permutation::ALL.size()>; | ||
| using LocatedTriplesPerBlockInternalPermutations = | ||
| std::array<LocatedTriplesPerBlock, 2>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This magic constant can also be computed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permutation::INTERNAL.size()
| struct LocatedTripleHandles { | ||
| using It = LocatedTriples::iterator; | ||
| std::array<It, Permutation::ALL.size()> handles_; | ||
| std::array<It, internal ? 2 : Permutation::ALL.size()> handles_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also no magic constant.
|
|
||
| LocatedTriples::iterator& forPermutation(Permutation::Enum permutation); | ||
| }; | ||
| template <bool internal> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really the bool, or rather the number of permutations:?
| Id objectId = ids.at(2); | ||
| auto optionalLiteralOrIri = ExportQueryExecutionTrees::idToLiteralOrIri( | ||
| index_, objectId, localVocab_); | ||
| if (optionalLiteralOrIri.has_value() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (! hasValue() ) continue;.
| auto predicate = ExportQueryExecutionTrees::idToLiteralOrIri( | ||
| index_, predicateId, localVocab_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best do some deduplication, don't look up the same predicate n times...
| modifyTriplesImpl(cancellationHandle, std::move(triples), true, | ||
| triplesInserted_, triplesDeleted_, tracer); | ||
| modifyTriplesImpl(std::move(cancellationHandle), std::move(internalTriples), | ||
| true, internalTriplesInserted_, internalTriplesDeleted_, | ||
| tracer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this become part of mdofiyTriplesImpl (which then doesn't get the triplesInserted_ but retrieves them itself.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or a wrapper that reduces the code duplication.
| return; | ||
| } | ||
| auto toRange = [](const TriplesToHandlesMap& map) { | ||
| auto toRange = [](const TriplesToHandlesMap<false>& map) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a discussion (at least a TODO) whether we should store the internal triples, instead of doing the (potentially expensive) backup when restarting.
| return ExportQueryExecutionTrees::idToLiteral( | ||
| context->_qec.getIndex().getImpl(), id, context->_localVocab); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an additional overload, instead of having to update all the call sites.
Qup42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question and a change from me for the review.
My understanding is that for triples where the object has a language tag the internal permutations stores the that triple with the predicate also having the language tag. So simplified for <foo> <bar> "baz"@en" something like @en@ "baz"is stored. Is this used for anything else thanFILTER(LANG(?x) = "...")`?
| LocatedTriples::iterator& | ||
| DeltaTriples::LocatedTripleHandles<internal>::forPermutation( | ||
| Permutation::Enum permutation) { | ||
| return handles_[static_cast<size_t>(permutation)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this assumes that the internal permutations PSO and POS are first and second in the enum for the index into the array to work out?
| ql::ranges::for_each(locatedTriples(), | ||
| &LocatedTriplesPerBlock::updateAugmentedMetadata); | ||
| ql::ranges::for_each(internalLocatedTriples_, | ||
| &LocatedTriplesPerBlock::updateAugmentedMetadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the metadata currently is somewhat (but not ludicrously) expensive. We'd only want to update it for the LocatedTriples that we actually changed. So here either locatedTriples() or internalLocatedTriples_. If there are no internal triples to update not at all.



This PR extends the
DeltaTriplesclass to also store changes for internal triples. It also implements a hook that adds internal triples for every object literal with language literals so that these internal triples are filled when required.This PR clashes with some changes in #2453
Currently WIP, unit tests are missing and some code might not be ideal yet.