Skip to content
Snippets Groups Projects
Unverified Commit 345463d4 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Disable humanization for native query results (#10196)

parent fdc75df8
No related branches found
No related tags found
No related merge requests found
......@@ -44,8 +44,7 @@
(vec (for [i (range (count columns))
:let [col (nth columns i)]]
{:name (name col)
:display_name (or (humanization/name->human-readable-name (u/keyword->qualified-name col))
(u/keyword->qualified-name col))
:display_name (u/keyword->qualified-name col)
:base_type (or (driver.common/values->base-type (for [row rows]
(nth row i)))
:type/*)
......
......@@ -450,7 +450,7 @@
:fields (map (comp #(merge (default-card-field-for-venues card-virtual-table-id) %)
with-field-literal-id)
[{:name "NAME"
:display_name "Name"
:display_name "NAME"
:base_type "type/Text"
:special_type "type/Name"
:fingerprint (:name mutil/venue-fingerprints)}
......@@ -461,13 +461,13 @@
:fingerprint (:id mutil/venue-fingerprints)}
(with-numeric-dimension-options
{:name "PRICE"
:display_name "Price"
:display_name "PRICE"
:base_type "type/Integer"
:special_type nil
:fingerprint (:price mutil/venue-fingerprints)})
(with-coordinate-dimension-options
{:name "LATITUDE"
:display_name "Latitude"
:display_name "LATITUDE"
:base_type "type/Float"
:special_type "type/Latitude"
:fingerprint (:latitude mutil/venue-fingerprints)})])})
......@@ -496,7 +496,7 @@
:description nil
:dimension_options (default-dimension-options)
:fields [{:name "NAME"
:display_name "Name"
:display_name "NAME"
:base_type "type/Text"
:table_id card-virtual-table-id
:id ["field-literal" "NAME" "type/Text"]
......@@ -508,7 +508,7 @@
:type {:type/Text {:percent-json 0.0, :percent-url 0.0,
:percent-email 0.0, :average-length 13.27}}}}
{:name "LAST_LOGIN"
:display_name "Last Login"
:display_name "LAST_LOGIN"
:base_type "type/DateTime"
:table_id card-virtual-table-id
:id ["field-literal" "LAST_LOGIN" "type/DateTime"]
......
......@@ -33,8 +33,8 @@
[99 "Golden Road Brewing" 10]]
:columns ["ID" "NAME" "CATEGORY_ID"]
:cols [{:name "ID", :display_name "ID", :source :native, :base_type :type/Integer}
{:name "NAME", :display_name "Name", :source :native, :base_type :type/Text}
{:name "CATEGORY_ID", :display_name "Category ID", :source :native, :base_type :type/Integer}]
{:name "NAME", :display_name "NAME", :source :native, :base_type :type/Text}
{:name "CATEGORY_ID", :display_name "CATEGORY_ID", :source :native, :base_type :type/Integer}]
:native_form {:query "SELECT ID, NAME, CATEGORY_ID FROM VENUES ORDER BY ID DESC LIMIT 2", :params []}}}
(-> (qp/process-query {:native {:query "SELECT ID, NAME, CATEGORY_ID FROM VENUES ORDER BY ID DESC LIMIT 2"}
:type :native
......
......@@ -19,8 +19,8 @@
;; make sure that `add-native-column-info` can still infer types even if the initial value(s) are `nil` (#4256)
(expect
[{:name "a", :display_name "A", :base_type :type/Integer, :source :native}
{:name "b", :display_name "B", :base_type :type/Integer, :source :native}]
[{:name "a", :display_name "a", :base_type :type/Integer, :source :native}
{:name "b", :display_name "b", :base_type :type/Integer, :source :native}]
(:cols (#'annotate/add-native-column-info {:columns [:a :b], :rows [[1 nil]
[2 nil]
[3 nil]
......@@ -30,7 +30,7 @@
;; make sure that `add-native-column-info` defaults `base_type` to `type/*` if there are no non-nil
;; values when we peek.
(expect
[{:name "a", :display_name "A", :base_type :type/*, :source :native}]
[{:name "a", :display_name "a", :base_type :type/*, :source :native}]
(:cols (#'annotate/add-native-column-info {:columns [:a], :rows [[nil]]})))
......
......@@ -48,7 +48,9 @@
:special_type "type/Longitude", :fingerprint (:longitude mutil/venue-fingerprints)}])
(def ^:private default-card-results-native
(update-in default-card-results [3 :fingerprint] assoc :type {:type/Number {:min 2.0, :max 74.0, :avg 29.98, :q1 7.0, :q3 49.0 :sd 23.06}}))
(for [column (-> default-card-results
(update-in [3 :fingerprint] assoc :type {:type/Number {:min 2.0, :max 74.0, :avg 29.98, :q1 7.0, :q3 49.0 :sd 23.06}}))]
(assoc column :display_name (:name column))))
;; test that Card result metadata is saved after running a Card
(expect
......
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