From 9a4702e88833935fade4c76c1fe1953ad0bfc5d9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 6 Jan 2024 01:39:42 +0000 Subject: [PATCH] Update backend docs on Sat Jan 6 01:39:42 UTC 2024 --- index.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 24077d9..81166d9 100644 --- a/index.html +++ b/index.html @@ -11725,7 +11725,7 @@

Important Libraries

(let [dashboard (t2/hydrate dashboard :resolved-params) constraints (chain-filter-constraints dashboard constraint-param-key->value) param (get-in dashboard [:resolved-params param-key]) - field-ids (map :field-id (param->fields param))] + field-ids (into #{} (map :field-id (param->fields param)))] (if (empty? field-ids) (or (filter-values-from-field-refs dashboard param-key) (throw (ex-info (tru "Parameter {0} does not have any Fields associated with it" (pr-str param-key)) @@ -36504,9 +36504,7 @@
`:abstract?` (default = false)
(when (integer? id-or-name) (:name (lib.metadata/field (qp.store/metadata-provider) id-or-name)))))
(defmethod ->honeysql [:sql :field]
-  [driver [_ id-or-name {:keys             [database-type]
-                         ::nest-query/keys [outer-select]
-                         :as               options}
+  [driver [_ id-or-name {:keys [database-type] :as options}
            :as field-clause]]
   (try
     (let [source-table-aliases (field-source-table-aliases field-clause)
@@ -36514,7 +36512,7 @@ 
`:abstract?` (default = false)
field (when (integer? id-or-name) (lib.metadata/field (qp.store/metadata-provider) id-or-name)) allow-casting? (and field - (not outer-select)) + (not (:qp/ignore-coercion options))) database-type (or database-type (:database-type field)) ;; preserve metadata attached to the original field clause, for example BigQuery temporal type information. @@ -36833,8 +36831,8 @@
`:abstract?` (default = false)
true (assoc ::add/source-alias (::add/desired-alias opts) ::add/source-table ::add/none - ;; sort of a HACK but this key will tell the SQL QP not to apply casting here either. - ::nest-query/outer-select true + ;; this key will tell the SQL QP not to apply casting here either. + :qp/ignore-coercion true ;; used to indicate that this is a forced alias ::forced-alias true) ;; don't want to do temporal bucketing or binning inside the order by only. @@ -79556,20 +79554,22 @@
`:fallback`
"Get implicit Fields for a query with a `:source-query` that has `source-metadata`." [source-metadata :- [:sequential {:min 1} mbql.s/SourceQueryMetadata]] (distinct - (for [{field-name :name, base-type :base_type, field-id :id, [ref-type :as field-ref] :field_ref} source-metadata] + (for [{field-name :name, base-type :base_type, field-id :id, [ref-type :as field-ref] :field_ref coercion-strategy :coercion_strategy} source-metadata] ;; return field-ref directly if it's a `:field` clause already. It might include important info such as ;; `:join-alias` or `:source-field`. Remove binning/temporal bucketing info. The Field should already be getting - ;; bucketed in the source query; don't need to apply bucketing again in the parent query. + ;; bucketed in the source query; don't need to apply bucketing again in the parent query. Mark the field as + ;; `qp/ignore-coercion` here so that it doesn't happen again in the parent query. (or (some-> (mbql.u/match-one field-ref :field) - (mbql.u/update-field-options dissoc :binning :temporal-unit)) + (mbql.u/update-field-options dissoc :binning :temporal-unit) + (cond-> coercion-strategy (mbql.u/assoc-field-options :qp/ignore-coercion true))) ;; otherwise construct a field reference that can be used to refer to this Field. ;; Force string id field if expression contains just field. See issue #28451. (if (and (not= ref-type :expression) field-id) ;; If we have a Field ID, return a `:field` (id) clause - [:field field-id nil] + [:field field-id (cond-> nil coercion-strategy (assoc :qp/ignore-coercion true))] ;; otherwise return a `:field` (name) clause, e.g. for a Field that's the result of an aggregation or - ;; expression + ;; expression. We don't need to mark as ignore-coercion here because these won't grab the field metadata [:field field-name {:base-type base-type}])))))

Whether we should add implicit Fields to this query. True if all of the following are true: