From 8bf9f8a525bdb934a5ed028b27e50c017f42d23b Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Tue, 9 Dec 2025 09:52:16 +0100 Subject: [PATCH 1/5] Small cleanups to fix the C++17 build. Signed-off-by: Johannes Kalmbach --- src/engine/ExportQueryExecutionTrees.cpp | 2 +- src/util/ConstexprMap.h | 4 ++-- src/util/Serializer/TripleSerializer.h | 19 +++++++++++++------ test/util/GTestHelpers.h | 8 +++++--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/engine/ExportQueryExecutionTrees.cpp b/src/engine/ExportQueryExecutionTrees.cpp index 2c3d740c0e..7f1b2cafc9 100644 --- a/src/engine/ExportQueryExecutionTrees.cpp +++ b/src/engine/ExportQueryExecutionTrees.cpp @@ -884,7 +884,7 @@ STREAMABLE_GENERATOR_TYPE ExportQueryExecutionTrees::selectQueryResultToStream( // special case : binary export of IdTable if constexpr (format == MediaType::octetStream) { - std::erase(selectedColumnIndices, std::nullopt); + ql::erase(selectedColumnIndices, std::nullopt); uint64_t resultSize = 0; for (const auto& [pair, range] : getRowIndices(limitAndOffset, *result, resultSize)) { diff --git a/src/util/ConstexprMap.h b/src/util/ConstexprMap.h index e807e7e790..4665f06ae2 100644 --- a/src/util/ConstexprMap.h +++ b/src/util/ConstexprMap.h @@ -48,7 +48,7 @@ class ConstexprMap { // Create from an Array of key-value pairs. The keys have to be unique. explicit constexpr ConstexprMap(Arr values) : _values{std::move(values)} { ql::ranges::sort(_values, compare); - if (::ranges::adjacent_find(_values, std::equal_to<>{}, &Pair::key_) != + if (::ranges::adjacent_find(_values, std::equal_to<>{}, getKey) != _values.end()) { throw std::runtime_error{ "ConstexprMap requires that all the keys are unique"}; @@ -58,7 +58,7 @@ class ConstexprMap { // If `key` is in the map, return an iterator to the corresponding `(Key, // Value)` pair. Else return `end()`. constexpr typename Arr::const_iterator find(const Key& key) const { - auto lb = ql::ranges::lower_bound(_values, key, std::less<>{}, &Pair::key_); + auto lb = ql::ranges::lower_bound(_values, key, std::less<>{}, getKey); if (lb == _values.end() || lb->key_ != key) { return _values.end(); } diff --git a/src/util/Serializer/TripleSerializer.h b/src/util/Serializer/TripleSerializer.h index d2bc025657..ab51714c9a 100644 --- a/src/util/Serializer/TripleSerializer.h +++ b/src/util/Serializer/TripleSerializer.h @@ -19,6 +19,7 @@ #include "util/Serializer/FileSerializer.h" #include "util/Serializer/SerializeArrayOrTuple.h" #include "util/Serializer/SerializeString.h" +#include "util/TransparentFunctors.h" #include "util/TypeTraits.h" #include "util/Views.h" @@ -102,13 +103,19 @@ CPP_template(typename Serializer)( CPP_template(typename Range, typename Serializer)( requires ql::ranges::range) void serializeIds(Serializer& serializer, Range&& range) { - ad_utility::serialization::VectorIncrementalSerializer - vectorSerializer{std::move(serializer)}; - for (const Id& value : range) { - vectorSerializer.push(value); + if constexpr (ql::ranges::contiguous_range>) { + serializer + << ql::span>>{ + range}; + } else { + ad_utility::serialization::VectorIncrementalSerializer + vectorSerializer{std::move(serializer)}; + for (const Id& value : range) { + vectorSerializer.push(value); + } + vectorSerializer.finish(); + serializer = std::move(vectorSerializer).serializer(); } - vectorSerializer.finish(); - serializer = std::move(vectorSerializer).serializer(); } // Deserialize a range of Ids from the input stream. If an Id is of type diff --git a/test/util/GTestHelpers.h b/test/util/GTestHelpers.h index 714a83811d..9d31d730da 100644 --- a/test/util/GTestHelpers.h +++ b/test/util/GTestHelpers.h @@ -199,9 +199,11 @@ auto liftOptionalMatcher(MakeMatcher makeMatcher) { // returns a function `ArrayType -> Matcher` that applies // `MakeMatcher` to each of the expected values in the argument of `ArrayType` // and returns an `ElementsAreArray` matcher of these submatchers. -template -requires std::is_convertible_v> -auto liftMatcherToElementsAreArray(MakeMatcher makeMatcher) { +CPP_template(typename T, typename ArrayType, typename MakeMatcher)( + requires std::is_convertible_v< + ArrayType, + std::vector>) auto liftMatcherToElementsAreArray(MakeMatcher + makeMatcher) { return [makeMatcher](ArrayType expectedValues) -> ::testing::Matcher { std::vector<::testing::Matcher> childMatchers; From 0a827586175d8b131dec90d5dc699a1ada3529ef Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Tue, 9 Dec 2025 12:23:53 +0100 Subject: [PATCH 2/5] More deactivation of `boost::url` Signed-off-by: Johannes Kalmbach --- src/engine/sparqlExpressions/StringExpressions.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine/sparqlExpressions/StringExpressions.cpp b/src/engine/sparqlExpressions/StringExpressions.cpp index bcb5822c39..3e98802da1 100644 --- a/src/engine/sparqlExpressions/StringExpressions.cpp +++ b/src/engine/sparqlExpressions/StringExpressions.cpp @@ -4,7 +4,9 @@ // // Copyright 2025, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +#ifndef QLEVER_REDUCED_FEATURE_SET_FOR_CPP17 #include +#endif #include "backports/StartsWithAndEndsWith.h" #include "engine/sparqlExpressions/LiteralExpression.h" @@ -521,6 +523,7 @@ class ConcatExpression : public detail::VariadicExpression { // ENCODE_FOR_URI struct EncodeForUriImpl { IdOrLiteralOrIri operator()(std::optional input) const { +#ifndef QLEVER_REDUCED_FEATURE_SET_FOR_CPP17 if (!input.has_value()) { return Id::makeUndefined(); } else { @@ -530,6 +533,10 @@ struct EncodeForUriImpl { boost::urls::encode(value, boost::urls::unreserved_chars)); } } +#else + throw std::runtime_error( + "EncodeForUri is not available in reduced feature set for C++17"); +#endif }; using EncodeForUriExpression = StringExpressionImpl<1, EncodeForUriImpl>; From ff975fd784f101bc648aac23fabc8159598f72fb Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Tue, 9 Dec 2025 16:19:45 +0100 Subject: [PATCH 3/5] Fix the stupid thing in C++17 mode... Signed-off-by: Johannes Kalmbach --- src/engine/sparqlExpressions/StringExpressions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/sparqlExpressions/StringExpressions.cpp b/src/engine/sparqlExpressions/StringExpressions.cpp index 3e98802da1..6c435b8700 100644 --- a/src/engine/sparqlExpressions/StringExpressions.cpp +++ b/src/engine/sparqlExpressions/StringExpressions.cpp @@ -532,11 +532,11 @@ struct EncodeForUriImpl { return toLiteral( boost::urls::encode(value, boost::urls::unreserved_chars)); } - } #else throw std::runtime_error( "EncodeForUri is not available in reduced feature set for C++17"); #endif + } }; using EncodeForUriExpression = StringExpressionImpl<1, EncodeForUriImpl>; From 8cd47cfe0e413f81873a5c903c38d4a620b64bb9 Mon Sep 17 00:00:00 2001 From: Edwin Barczynski Date: Wed, 3 Dec 2025 11:40:10 +0100 Subject: [PATCH 4/5] change batch size of stream_generator for QNX --- src/util/stream_generator.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/stream_generator.h b/src/util/stream_generator.h index 6cee970861..f1df384f93 100644 --- a/src/util/stream_generator.h +++ b/src/util/stream_generator.h @@ -302,7 +302,7 @@ stream_generator_promise::get_return_object() noexcept { } // namespace detail // Use 1MiB buffer size by default -using stream_generator = basic_stream_generator<1u << 20>; +using stream_generator = basic_stream_generator<1000>; #endif @@ -313,7 +313,11 @@ using stream_generator = basic_stream_generator<1u << 20>; // NOTE: A `string_view` that is pushed via `operator()` might and often will be // split up between two callback invocations. The callback for the final batch // is invoked either in the destructor or via an explicit call to `finish()`. +<<<<<<< HEAD template +======= +template +>>>>>>> a99ccca4 (change batch size of stream_generator for QNX) class StringBatcher { using CallbackForBatches = std::function; CallbackForBatches callbackForBatches_; From 2a4f1fbbde0985bd3fb5ad6cfccec499a7f27933 Mon Sep 17 00:00:00 2001 From: Edwin Barczynski Date: Tue, 9 Dec 2025 17:36:19 +0100 Subject: [PATCH 5/5] fix batch size mistake --- src/util/stream_generator.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/util/stream_generator.h b/src/util/stream_generator.h index f1df384f93..f4f66a827a 100644 --- a/src/util/stream_generator.h +++ b/src/util/stream_generator.h @@ -313,11 +313,7 @@ using stream_generator = basic_stream_generator<1000>; // NOTE: A `string_view` that is pushed via `operator()` might and often will be // split up between two callback invocations. The callback for the final batch // is invoked either in the destructor or via an explicit call to `finish()`. -<<<<<<< HEAD template -======= -template ->>>>>>> a99ccca4 (change batch size of stream_generator for QNX) class StringBatcher { using CallbackForBatches = std::function; CallbackForBatches callbackForBatches_;