Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Add test showing that day-of-week is not a temporal on the next stage (#75821)

metamben88fd6b6d9085
diff --git a/test/metabase/lib/temporal_bucket_test.cljc b/test/metabase/lib/temporal_bucket_test.cljc
index cd23c7c4aa5..08d4f10777b 100644
--- a/test/metabase/lib/temporal_bucket_test.cljc
+++ b/test/metabase/lib/temporal_bucket_test.cljc
@@ -260,3 +260,16 @@
(->> (lib/breakouts query)
first
(lib/display-info query -1))))))
+
+(deftest ^:parallel extraction-unit-strips-temporal-effective-type-in-next-stage-test
+ (testing "after a stage breaks out by an extraction unit (e.g. :day-of-week), the column in the next stage
+ must not advertise a temporal effective-type, so the FE doesn't propose nonsensical buckets/binning
+ like \"Month\" on top of an integer (#48932)"
+ (let [query (-> (lib/query meta/metadata-provider (meta/table-metadata :orders))
+ (lib/breakout (lib/with-temporal-bucket (meta/field-metadata :orders :created-at) :day-of-week))
+ lib/append-stage)
+ [created-at] (lib/visible-columns query 1)]
+ (is (=? {:name "CREATED_AT"
+ :display-name "Created At: Day of week"
+ :effective-type :type/Integer}
+ created-at)))))