Skip to content
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 datasets from parameters for Query and Update #1714

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Qup42
Copy link
Member

@Qup42 Qup42 commented Jan 17, 2025

Add support for datasets from parameters for Update and activates it for Query. (It was already present for Query before, but an assert prevented it's usage until now.) This PR also changes most of the dataset from parameter handling that was there before.

Resolves #1712

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 47.05882% with 36 lines in your changes missing coverage. Please review.

Project coverage is 89.87%. Comparing base (acb6633) to head (077cabb).

Files with missing lines Patch % Lines
src/engine/Server.cpp 41.93% 36 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1714   +/-   ##
=======================================
  Coverage   89.86%   89.87%           
=======================================
  Files         389      389           
  Lines       37308    37322   +14     
  Branches     4204     4204           
=======================================
+ Hits        33527    33543   +16     
+ Misses       2485     2482    -3     
- Partials     1296     1297    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

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

Thank you very much, I have some suggestions for cleaner code etc.

src/engine/Server.cpp Outdated Show resolved Hide resolved
Comment on lines 1001 to 1002
} else {
AD_FAIL();
Copy link
Member

Choose a reason for hiding this comment

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

Can this statically happen?
Otherwise you can replace the else if constexpr by else static_assert

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by doing this statically? The comment is now applied and also a static_assert(std::is_same_v<Operation, Query> || std::is_same_v<Operation, Update>) at the beginning (which my IDE marked at some time). What would be a good style for doing this (the static_assert in the else is redundant now)?

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind the redundant static assert in the beginning.
The one in the beginning gives nice documentation + error messages,
And in the if-else it is useful to prevent bugs etc. So I really like the way it is now.

Comment on lines 1046 to 1049
return operation.update_;
} else {
AD_FAIL();
}
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above.

@Qup42
Copy link
Member Author

Qup42 commented Jan 22, 2025

There was one random test failure in a run that was most likely not from this PR: https://github.com/ad-freiburg/qlever/actions/runs/12833696568/job/35789345340?pr=1714

@sparql-conformance
Copy link

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

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

Two and a half very minor comments, this is close to finished now.

Comment on lines +980 to +981
static_assert(std::is_same_v<Operation, Query> ||
std::is_same_v<Operation, Update>);
Copy link
Member

Choose a reason for hiding this comment

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

I think we have something like ad_utility::SameAsAny<Operation, Query, Update> in the util/TypeTraits.h header.

Comment on lines 1041 to 1046
const std::string operationStr = [&operation] {
if constexpr (std::is_same_v<Operation, Query>) {
return operation.query_;
} else if constexpr (std::is_same_v<Operation, Update>) {
return operation.update_;
} else {
AD_FAIL();
static_assert(std::is_same_v<Operation, Update>);
return operation.update_;
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to copy the (possibly large) string here?
Either return and store a const& from the lambda, or at least move the string into the following functions (if composeErrorResponseJson requires a string by value).

Comment on lines 1001 to 1002
} else {
AD_FAIL();
Copy link
Member

Choose a reason for hiding this comment

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

I don't mind the redundant static assert in the beginning.
The one in the beginning gives nice documentation + error messages,
And in the if-else it is useful to prevent bugs etc. So I really like the way it is now.

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.

Not supported: default-graph-uri parameter
2 participants