From 3c5749665598d40fb69454222d248fadb11c7bf3 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 30 Jul 2022 22:57:30 +0100 Subject: [PATCH] Ensure aliased GROUP BY fields are output correctly --- lib/src/dbs/iterator.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/dbs/iterator.rs b/lib/src/dbs/iterator.rs index 75c7f94b..64bb501d 100644 --- a/lib/src/dbs/iterator.rs +++ b/lib/src/dbs/iterator.rs @@ -204,7 +204,10 @@ impl Iterator { if let Field::Alias(v, i) = field { match v { Value::Function(f) if f.is_aggregate() => { - let x = vals.all().get(ctx, opt, txn, i).await?; + let x = vals + .all() + .get(ctx, opt, txn, v.to_idiom().as_ref()) + .await?; let x = f.aggregate(x).compute(ctx, opt, txn, None).await?; obj.set(ctx, opt, txn, i, x).await?; }