-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add lazy computation to SERVICE #1514
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1514 +/- ##
=======================================
Coverage 88.12% 88.13%
=======================================
Files 357 357
Lines 26764 26779 +15
Branches 3606 3609 +3
=======================================
+ Hits 23587 23602 +15
+ Misses 1941 1940 -1
- Partials 1236 1237 +1 ☔ 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.
Looks great, only minor suggestions remaining.
src/engine/Service.cpp
Outdated
// For the non-lazy case the generator is supposed to yield exactly one | ||
// idTable. | ||
auto iterator = generator.begin(); | ||
AD_CORRECTNESS_CHECK(iterator != generator.end()); | ||
IdTable idTable = std::move(*iterator); | ||
AD_CORRECTNESS_CHECK(++iterator == generator.end()); |
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.
We should have this as a (probably templated) helper function getSingleElement(generator<Irgendwas>)
in Generator.h
, then all the lazy operations can use this (you have copied this from filter or GroupBy,have you.
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.
And of course don't forget to
- Add unit tests for this
- Also integrate it into Filter.cpp and GroupBy.cpp
test/ServiceTest.cpp
Outdated
for ([[maybe_unused]] auto& _ : lazyResult.idTables()) { | ||
} |
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.
You should of course check the result. You can for example initialize an IdTable, and append all the partial results via insertAtEnd
.
boost::beast::http::status::ok, "application/sparql-results+json")}; | ||
|
||
AD_EXPECT_THROW_WITH_MESSAGE( | ||
service8.computeResultOnlyForTesting(), |
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 not lazy, am i right?
When being lazy, you should probably see an error during the consumation of the generator (at least for the invalid Json
kind of error.
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Quality Gate passedIssues Measures |
Enables the
SERVICE
to compute it's result lazily, s.t. whenrequestLaziness
is set in the call toService::computeResult
the result will contain agenerator<IdTable>
instead of fully materializing it.