Skip to content
Snippets Groups Projects
Commit 731b8f5d authored by Cam Saul's avatar Cam Saul
Browse files

Keep QP schema validation exception sizes reasonable

parent 131bdc4d
Branches
Tags
No related merge requests found
......@@ -23,7 +23,7 @@
(dissoc :database :driver)
u/ignore-exceptions))}
(when-let [data (ex-data e)]
{:ex-data data})
{:ex-data (dissoc data :schema)})
additional-info))
(defn- explain-schema-validation-error
......
(ns metabase.query-processor.expand-resolve-test
"Tests query expansion/resolution"
(:require [expectations :refer :all]
(:require [clojure.string :as str]
[expectations :refer :all]
[metabase
[query-processor :as qp]
[util :as u]]
[metabase.query-processor.middleware
[expand :as ql]
[resolve :as resolve]
[source-table :as source-table]]
[metabase.test
[data :refer :all]
[data :as data :refer :all]
[util :as tu]]
[metabase.test.data.dataset-definitions :as defs]
[metabase.util :as u]))
[metabase.test.data.dataset-definitions :as defs]))
;; this is here because expectations has issues comparing and object w/ a map and most of the output
;; below has objects for the various place holders in the expanded/resolved query
......@@ -321,3 +324,16 @@
(tu/boolean-ids-and-timestamps
(mapv obj->map [expanded-form
(resolve' expanded-form)]))))
;; check that a schema invalidation error produces a reasonably-sized exception, < 50 lines.
;; previously the entire schema was being dumped which resulted in a ~5200 line exception (#5978)
(expect
(-> (qp/process-query
{:database (data/id)
:type :query
:query {:source-table (data/id :venues)
:filter [:and nil]}})
u/pprint-to-str
str/split-lines
count
(< 50)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment