Skip to content
Snippets Groups Projects
Commit 34c1d1f2 authored by Cam Saül's avatar Cam Saül
Browse files

Don't apply magic sorting to BigQuery native queries :imp:

parent 558817cb
No related branches found
No related tags found
No related merge requests found
......@@ -351,7 +351,7 @@
results (if mbql?
(post-process-mbql dataset-id table-name results)
(update results :columns (partial map keyword)))]
(assoc results :annotate? true)))
(assoc results :annotate? mbql?)))
;; This provides an implementation of `prepare-value` that prevents HoneySQL from converting forms to prepared statement parameters (`?`)
;; TODO - Move this into `metabase.driver.generic-sql` and document it as an alternate implementation for `prepare-value` (?)
......
......@@ -77,3 +77,15 @@
:type :native
:database (data/id)})
[:data :rows]))
;; make sure that BigQuery native queries maintain the column ordering specified in the SQL -- post-processing ordering shouldn't apply (Issue #2821)
(expect-with-engine :bigquery
["venue_id" "user_id" "checkins_id"]
(get-in (qp/process-query {:native {:query (apply format "SELECT [%stest_data.checkins.venue_id] AS [venue_id], [%stest_data.checkins.user_id] AS [user_id], [%stest_data.checkins.id] AS [checkins_id]
FROM [%stest_data.checkins]
LIMIT 2"
(repeat 4 bq-data/unique-prefix))}
:type :native
:database (data/id)})
[:data :columns]))
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