Skip to content
Snippets Groups Projects
Commit 6bddcf11 authored by Ryan Senior's avatar Ryan Senior
Browse files

Ensure aggregation expressions have base_type included

This bug appears when an aggregate expression has a nested
expression. Previously it was only looking for an expression reference
and not a full expression.

Fixes #6363
parent c952a60a
No related branches found
No related tags found
No related merge requests found
......@@ -169,7 +169,8 @@
;; hardcoding these types is fine; In the future when we extend Expressions to handle more functionality
;; we'll want to introduce logic that associates a return type with a given expression. But this will work
;; for the purposes of a patch release.
(when (instance? ExpressionRef ag-field)
(when (or (instance? ExpressionRef ag-field)
(instance? Expression ag-field))
{:base-type :type/Float
:special-type :type/Number})))
......
......@@ -97,3 +97,13 @@
(ql/expressions {:x (ql/* $price 2.0)})
(ql/aggregation (ql/count))
(ql/breakout (ql/expression :x))))))
;; Custom aggregation expressions should include their type
(datasets/expect-with-engines (engines-that-support :expressions)
#{{:name "CATEGORY_ID" :base_type :type/Integer}
{:name "x" :base_type :type/Float}}
(set (map #(select-keys % [:name :base_type])
(-> (data/run-query venues
(ql/aggregation (ql/named (ql/sum (ql/* $price -1)) "x"))
(ql/breakout $category_id))
(get-in [:data :cols])))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment