From c0dc5074ed2456159581b80593758b949edc4034 Mon Sep 17 00:00:00 2001
From: Ryan Senior <ryan@metabase.com>
Date: Thu, 31 Aug 2017 13:01:40 -0500
Subject: [PATCH] Add type information to expression columns

Expressions aren't columns, but they have an entry in the cols
property which currently doesn't have type info. This adds that which
allows it to be used as the Y-axis in graphs.

Fixes #3952
---
 src/metabase/query_processor/annotate.clj | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/metabase/query_processor/annotate.clj b/src/metabase/query_processor/annotate.clj
index 450a533ea27..3138b09f88e 100644
--- a/src/metabase/query_processor/annotate.clj
+++ b/src/metabase/query_processor/annotate.clj
@@ -69,7 +69,10 @@
        :field-display-name (humanization/name->human-readable-name (:field-name this)))]
 
     metabase.query_processor.interface.ExpressionRef
-    [(assoc this :field-display-name (:expression-name this))]
+    [(assoc this
+       :field-display-name (:expression-name this)
+       :base-type          :type/Float
+       :special-type       :type/Number)]
 
     ;; for every value in a map in the query we'll descend into the map and find all the fields contained therein and mark the key as each field's source.
     ;; e.g. if we descend into the `:breakout` columns for a query each field returned will get a `:source` of `:breakout`
-- 
GitLab