-
Notifications
You must be signed in to change notification settings - Fork 65
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
Enable pre-filtering (using PrefilterExpressionIndex
) of Date
values over expression YEAR()
.
#1820
base: master
Are you sure you want to change the base?
Enable pre-filtering (using PrefilterExpressionIndex
) of Date
values over expression YEAR()
.
#1820
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1820 +/- ##
==========================================
+ Coverage 90.18% 90.20% +0.02%
==========================================
Files 400 400
Lines 38440 38526 +86
Branches 4306 4318 +12
==========================================
+ Hits 34666 34753 +87
- Misses 2479 2480 +1
+ Partials 1295 1293 -2 ☔ View full report in Codecov by Sentry. |
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 looks very nice and clean, I only have a few remarks.
Conformance check passed ✅No test result changes. |
|
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 is almost ready to merge,
I have very few suggestions, one of which improves the code coverage
} else if constexpr (std::is_same_v<std::decay_t<T>, | ||
LocalVocabEntry>) { | ||
throw std::runtime_error(absl::StrCat( | ||
"Provided Literal or Iri with value: ", | ||
value.asLiteralOrIri().toStringRepresentation(), | ||
". This is an invalid reference value for filtering date " | ||
"values over expression YEAR. Please provide an integer " | ||
"value as reference year.")); | ||
} | ||
throw std::runtime_error( |
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.
Make this else {static_assert}
instead of else if ...
,
because the final throw is unreachable and because the code becomes more robust that way.
[](const IdOrLocalVocabEntry& referenceValue) { | ||
return std::visit( | ||
[]<typename T>(const T& value) -> ValueId { | ||
if constexpr (std::is_same_v<std::decay_t<T>, ValueId>) { |
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.
use ad_utility::SimilarTo
instead of same<decay<
(shorter and more expressive.
// Use for testing only. The definition here is necessary to call | ||
// `makePrefilterYearImpl` with an invalid `CompOp` argument given that it is |
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.
Do you mean This function is public s.t. we can test the corner case of...
?
// needs to be applied for the creation of `PrefilterExpression`. | ||
static std::optional<std::pair<Variable, bool>> getOptVariableAndIsYear( | ||
const SparqlExpression* child) { | ||
// (1) The direct child already contains the Variable. |
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.
Simpler workflow:
bool isYear = false;
if (child->isYearExpression) {
isYear = true;
child = child->child; // pseudocode.
}
... // need to check teh isVariable
only once.
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 overwriting the varaibel child
doesn't work, introduce some additional variable.)
No description provided.