The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
fix: add test for join behavior for 64317 fix (#64335)
Edward Pagete75dd496b8a5
diff --git a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.cljindex d537a574ab0..3bfa6976864 100644--- a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj+++ b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj@@ -1579,3 +1579,24 @@(let [day-int (parse-long day)](<= 1 day-int 31))))(next result))))))))))++(deftest sandboxed-join-excludes-hidden-columns-test+ (testing "When joining to a sandboxed table, hidden columns should not be added to join fields (#64317)"+ (mt/dataset test-data+ (met/with-gtaps! {:gtaps {:people {:query (mt/mbql-query people+ {:fields [$id $address $email $name $city]})}}+ :attributes {}}+ (let [query (mt/mbql-query orders+ {:joins [{:fields :all+ :source-table $$people+ :condition [:= $user_id &people.people.id]+ :alias "people"}]+ :limit 10})+ preprocessed (qp.preprocess/preprocess query)]+ (testing "Preprocessed query only include fields in sandbox query"+ (is (=? [[:field {:join-alias "people" :lib/uuid string?} (mt/id :people :id)]+ [:field {:join-alias "people" :lib/uuid string?} (mt/id :people :address)]+ [:field {:join-alias "people" :lib/uuid string?} (mt/id :people :email)]+ [:field {:join-alias "people" :lib/uuid string?} (mt/id :people :name)]+ [:field {:join-alias "people" :lib/uuid string?} (mt/id :people :city)]]+ (-> preprocessed lib/joins first lib/join-fields)))))))))