Skip to content
Snippets Groups Projects
Unverified Commit e441ff30 authored by Jeff Evans's avatar Jeff Evans Committed by GitHub
Browse files

Snowflake: fix error in aggregation expression having different casing in order clause (#18221)

Remove the `driver/format-custom-field-name` implementation for :snowflake, which was causing the problem and appears to be no longer needed anyway

Add test for this scenario to `metabase.query-processor-test.expression-aggregations-test`
parent 8f4d867b
No related branches found
No related tags found
No related merge requests found
......@@ -275,10 +275,6 @@
(defmethod sql.qp/current-datetime-honeysql-form :snowflake [_] :%current_timestamp)
(defmethod driver/format-custom-field-name :snowflake
[_ s]
(str/lower-case s))
;; See https://docs.snowflake.net/manuals/sql-reference/data-types-datetime.html#timestamp.
(defmethod driver.common/current-db-time-date-formatters :snowflake
[_]
......
......@@ -274,6 +274,20 @@
{:aggregation [[:sum [:expression "double-price"]]]
:expressions {"double-price" [:* $price 2]}})))))))
(deftest order-by-named-aggregation-test
(testing "Ordering by a named aggregation whose alias has uppercase letters works (#18211)"
(mt/test-drivers (mt/normal-drivers-with-feature :expression-aggregations)
(mt/dataset sample-dataset
(is (= [["Doohickey" 156.6]
["Widget" 170.3]
["Gadget" 181.9]
["Gizmo" 185.5]]
(mt/formatted-rows [str 1.0]
(mt/run-mbql-query products
{:aggregation [[:aggregation-options [:sum $rating] {:name "MyCE"}]]
:breakout [$category]
:order-by [[:asc [:aggregation 0]]]}))))))))
#_(deftest multiple-cumulative-sums-test
(mt/test-drivers (mt/normal-drivers-with-feature :expression-aggregations)
(testing "The results of divide or multiply two CumulativeSum should be correct (#15118)"
......
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