From d99c00c7a008e8ec43064b80ddbf942fb2cce134 Mon Sep 17 00:00:00 2001 From: Quentin Sabah Date: Tue, 19 Dec 2023 10:03:18 +0100 Subject: [PATCH] fix `apply` on user-defined aggregate `init` (#2456) The `init` expression of user-define aggregates was never handed-over to `apply`'s `mapper`. One visible issue is that the `TupleId` transformer would not update the tuple of the `init` expression while shuffling tuple identifiers. That would then result in the `init` expression peeking data in the wrong tuple during execution of the RAM program. --- src/ram/Aggregate.h | 1 + src/ram/IndexAggregate.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ram/Aggregate.h b/src/ram/Aggregate.h index 5d1d5291597..06b663e7849 100644 --- a/src/ram/Aggregate.h +++ b/src/ram/Aggregate.h @@ -72,6 +72,7 @@ class Aggregate : public RelationOperation, public AbstractAggregate { for (auto &elem : orderBy) { elem->expr = map(std::move(elem->expr)); } + function->apply(map); } static bool classof(const Node* n) { diff --git a/src/ram/IndexAggregate.h b/src/ram/IndexAggregate.h index 32a8251db0a..b715975ce85 100644 --- a/src/ram/IndexAggregate.h +++ b/src/ram/IndexAggregate.h @@ -74,6 +74,7 @@ class IndexAggregate : public IndexOperation, public AbstractAggregate { for (auto &elem : orderBy) { elem->expr = map(std::move(elem->expr)); } + function->apply(map); } static bool classof(const Node* n) {