Skip to content

Conversation

@joka921
Copy link
Member

@joka921 joka921 commented Oct 28, 2025

This commit includes C++17 compatibility fixes for the SPARQL expressions module:

  • Use inline constexpr variables instead of C++20 consteval
  • Replace template auto parameters with explicit template parameters where needed
  • Add [[maybe_unused]] attribute using QL_MAYBE_UNUSED macro
  • Use std::invoke for member function pointers and function objects
  • Replace direct lambda capture of constexpr variables with references
  • Add missing #ifndef guards for unreachable code paths in switch statements
  • Update template syntax for better C++17 compatibility
  • Use explicit instantiation for complex template types

🤖 Generated with Claude Code

This commit includes C++17 compatibility fixes for the SPARQL expressions module:
- Use inline constexpr variables instead of C++20 consteval
- Replace template auto parameters with explicit template parameters where needed
- Add [[maybe_unused]] attribute using QL_MAYBE_UNUSED macro
- Use std::invoke for member function pointers and function objects
- Replace direct lambda capture of constexpr variables with references
- Add missing #ifndef guards for unreachable code paths in switch statements
- Update template syntax for better C++17 compatibility
- Use explicit instantiation for complex template types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Member Author

@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.

A round of self-reviews.

if constexpr (std::is_constructible_v<R, decltype(AD_FWD(x))>) {
if constexpr (std::is_constructible_v<R, decltype(AD_FWD(x))> &&
!ad_utility::similarToInstantiation<R,
VectorWithMemoryLimit>) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Have a look at what is going on here (it has to do with the expression types and the private/publicness of the clone method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe postpone this to another PR, as it is nontrivial, and connected to other things.

Comment on lines 637 to 645
StringExpressionImpl<1, Hash<decltype(ad_utility::hashMd5)>>;
using SHA1Expression =
StringExpressionImpl<1, decltype(hash<ad_utility::hashSha1>)>;
StringExpressionImpl<1, Hash<decltype(ad_utility::hashSha1)>>;
using SHA256Expression =
StringExpressionImpl<1, decltype(hash<ad_utility::hashSha256>)>;
StringExpressionImpl<1, Hash<decltype(ad_utility::hashSha256)>>;
using SHA384Expression =
StringExpressionImpl<1, decltype(hash<ad_utility::hashSha384>)>;
StringExpressionImpl<1, Hash<decltype(ad_utility::hashSha384)>>;
using SHA512Expression =
StringExpressionImpl<1, decltype(hash<ad_utility::hashSha512>)>;
StringExpressionImpl<1, Hash<decltype(ad_utility::hashSha512)>>;
Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can get rid of the decltype and then also of the inline variables in the header.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, those are fine for now.

Signed-off-by: Johannes Kalmbach <[email protected]>
#define INSTANTIATE_AGG_EXP(Function, ValueGetter) \
template class AggregateExpression< \
Operation<2, FunctionAndValueGetters<Function, ValueGetter>>>;
INSTANTIATE_AGG_EXP(decltype(addForSum), NumericValueGetter);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason that this decltype(addForSum) is not rewritten like the other cases below?

};
using AvgOperation =
Operation<2,
FunctionAndValueGetters<decltype(addForSum), NumericValueGetter>>;
Copy link
Member

Choose a reason for hiding this comment

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

same here

[[nodiscard]] VectorWithMemoryLimit clone() const {
// Call the private copy constructor.
return VectorWithMemoryLimit(*this);
return VectorWithMemoryLimit(CloneTag{}, *this);
Copy link
Member

Choose a reason for hiding this comment

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

could you please explain what is going on here, in particular what the purpose of the CloneTag struct is?

Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
Copy link
Member

@ullingerc ullingerc left a comment

Choose a reason for hiding this comment

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

If the checks run through now, I'm happy with this.

@sparql-conformance
Copy link

Overview

Number of Tests Passed ✅ Failed ❌ Intended ⚠️ Not tested
525 439 19 67 0

Conformance check passed ✅

No test result changes.

Details: https://qlever.dev/sparql-conformance-ui?cur=81bcb40a21041d90ed4c0b3b12c6e658afb7ae2c&prev=3f7a4ccad4f322dbce5c85f517844651b4b189a0

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 98.42520% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.06%. Comparing base (3f7a4cc) to head (81bcb40).

Files with missing lines Patch % Lines
...ne/sparqlExpressions/RelationalExpressionHelpers.h 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2471      +/-   ##
==========================================
- Coverage   91.07%   91.06%   -0.02%     
==========================================
  Files         466      466              
  Lines       39706    39691      -15     
  Branches     5309     5309              
==========================================
- Hits        36164    36145      -19     
- Misses       2034     2035       +1     
- Partials     1508     1511       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

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.

2 participants