From 896df47f275e3d8d2a3ac3c381e504c3920c2004 Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Fri, 20 Dec 2024 16:04:36 +0100 Subject: [PATCH] Small tweaks. Signed-off-by: Johannes Kalmbach --- src/engine/GroupBy.cpp | 10 +++++++--- test/GroupByTest.cpp | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/engine/GroupBy.cpp b/src/engine/GroupBy.cpp index cc43379d9..a6ff49bbe 100644 --- a/src/engine/GroupBy.cpp +++ b/src/engine/GroupBy.cpp @@ -379,8 +379,9 @@ ProtoResult GroupBy::computeResult(bool requestLaziness) { if (subresult->isFullyMaterialized()) { // `computeWithHashMap` takes a range, so we artificially create one with // a single input. - return computeWithHashMap(std::array{std::pair{ - std::ref(subresult->idTable()), subresult->getCopyOfLocalVocab()}}); + return computeWithHashMap( + std::array{std::pair{std::cref(subresult->idTable()), + std::cref(subresult->localVocab())}}); } else { return computeWithHashMap(std::move(subresult->idTables())); } @@ -1512,8 +1513,11 @@ Result GroupBy::computeGroupByForHashMapOptimization( ad_utility::Timer lookupTimer{ad_utility::Timer::Stopped}; ad_utility::Timer aggregationTimer{ad_utility::Timer::Stopped}; - for (const auto& [inputTableRef, inputLocalVocab] : subresults) { + for (const auto& [inputTableRef, inputLocalVocabRef] : subresults) { + // Also support `std::reference_wrapper` as the input. const IdTable& inputTable = inputTableRef; + const LocalVocab& inputLocalVocab = inputLocalVocabRef; + localVocab.mergeWith(std::span{&inputLocalVocab, 1}); // Initialize evaluation context sparqlExpression::EvaluationContext evaluationContext( diff --git a/test/GroupByTest.cpp b/test/GroupByTest.cpp index 5aa0b1bc1..b3a672590 100644 --- a/test/GroupByTest.cpp +++ b/test/GroupByTest.cpp @@ -788,6 +788,9 @@ TEST_F(GroupByOptimizations, hashMapOptimizationLazyAndMaterializedInputs) { }; runTest(true); runTest(false); + + // Disable optimization for following tests + RuntimeParameters().set<"group-by-hash-map-enabled">(false); } // _____________________________________________________________________________