diff --git a/modules/drivers/bigquery/test/metabase/driver/bigquery/query_processor_test.clj b/modules/drivers/bigquery/test/metabase/driver/bigquery/query_processor_test.clj index bbc39bdc96c5d2b43a7f75e23015aaa8e22dff44..5f640bdcd008bd9bbd58e43058ae64dc986ccebb 100644 --- a/modules/drivers/bigquery/test/metabase/driver/bigquery/query_processor_test.clj +++ b/modules/drivers/bigquery/test/metabase/driver/bigquery/query_processor_test.clj @@ -715,5 +715,5 @@ "FROM `v3_test_data.checkins` " "LEFT JOIN `v3_test_data.Organização` `Organização__via__venue_id`" " ON `v3_test_data.checkins`.`venue_id` = `Organização__via__venue_id`.`id` " - "LIMIT 1048576") + "LIMIT 1048575") (:query (qp/query->native query)))))))))) diff --git a/modules/drivers/sqlserver/test/metabase/driver/sqlserver_test.clj b/modules/drivers/sqlserver/test/metabase/driver/sqlserver_test.clj index e9cdbea0c05a799b8c73ae2192cdf94223bf373d..bacdd6f338310efd3a1075cf0992ecd0418b5743 100644 --- a/modules/drivers/sqlserver/test/metabase/driver/sqlserver_test.clj +++ b/modules/drivers/sqlserver/test/metabase/driver/sqlserver_test.clj @@ -73,9 +73,9 @@ (mt/test-driver :sqlserver (testing (str "SQL Server doesn't let you use ORDER BY in nested SELECTs unless you also specify a TOP (their " "equivalent of LIMIT). Make sure we add a max-results LIMIT to the nested query") - (is (= {:query (str "SELECT TOP 1048576 \"source\".\"name\" AS \"name\" " + (is (= {:query (str "SELECT TOP 1048575 \"source\".\"name\" AS \"name\" " "FROM (" - "SELECT TOP 1048576 " + "SELECT TOP 1048575 " "\"dbo\".\"venues\".\"name\" AS \"name\" " "FROM \"dbo\".\"venues\" " "ORDER BY \"dbo\".\"venues\".\"id\" ASC" @@ -123,7 +123,7 @@ (qp.test-util/with-everything-store (is (= {:query (str "SELECT \"source\".\"name\" AS \"name\" " "FROM (" - "SELECT TOP 1048576 " + "SELECT TOP 1048575 " "\"dbo\".\"venues\".\"name\" AS \"name\" " "FROM \"dbo\".\"venues\" " "ORDER BY \"dbo\".\"venues\".\"id\" ASC" diff --git a/src/metabase/query_processor/interface.clj b/src/metabase/query_processor/interface.clj index 355abe0ff76919bffffd1631669f80b135551522..9b9060aba5d3211ca41122cdc59ee62a360dbfc9 100644 --- a/src/metabase/query_processor/interface.clj +++ b/src/metabase/query_processor/interface.clj @@ -7,9 +7,12 @@ (def absolute-max-results "Maximum number of rows the QP should ever return. - This is coming directly from the max rows allowed by Excel for now ... - https://support.office.com/en-nz/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3" - 1048576) + This is coming directly from the max rows allowed by Excel for now ... + https://support.office.com/en-nz/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 + + This is actually one less than the number of rows allowed by Excel, since we have a header row. See #13585 for more + details." + 1048575) ;; TODO - maybe we should do this more generally with the help of a macro like `do-with-suppressed-output` from the ;; test utils, perhaps implemented as separate middleware (and using a `:middleware` option). Or perhaps even make QP diff --git a/test/metabase/api/dataset_test.clj b/test/metabase/api/dataset_test.clj index ac27d418466bdaf6e5cef4fee059d1550d290202..afbfa1704325b6547ee0ddd4d6222813301b573e 100644 --- a/test/metabase/api/dataset_test.clj +++ b/test/metabase/api/dataset_test.clj @@ -318,7 +318,7 @@ (testing "\nCan we fetch a native version of an MBQL query?" (is (= {:query (str "SELECT \"PUBLIC\".\"VENUES\".\"ID\" AS \"ID\", \"PUBLIC\".\"VENUES\".\"NAME\" AS \"NAME\" " "FROM \"PUBLIC\".\"VENUES\" " - "LIMIT 1048576") + "LIMIT 1048575") :params nil} (mt/user-http-request :rasta :post 200 "dataset/native" (mt/mbql-query venues @@ -328,7 +328,7 @@ (is (= {:query (str "SELECT \"PUBLIC\".\"CHECKINS\".\"ID\" AS \"ID\" FROM \"PUBLIC\".\"CHECKINS\" " "WHERE (\"PUBLIC\".\"CHECKINS\".\"DATE\" >= timestamp with time zone '2015-11-13 00:00:00.000Z'" " AND \"PUBLIC\".\"CHECKINS\".\"DATE\" < timestamp with time zone '2015-11-14 00:00:00.000Z') " - "LIMIT 1048576") + "LIMIT 1048575") :params nil} (mt/user-http-request :rasta :post 200 "dataset/native" (mt/mbql-query checkins diff --git a/test/metabase/driver/common/parameters/values_test.clj b/test/metabase/driver/common/parameters/values_test.clj index 75cd9275b5e3d86a07aceaa561766251ab01854b..8624749fa128f292775c3c5355ef909706c0be45 100644 --- a/test/metabase/driver/common/parameters/values_test.clj +++ b/test/metabase/driver/common/parameters/values_test.clj @@ -214,7 +214,7 @@ "\"PUBLIC\".\"VENUES\".\"PRICE\" AS \"PRICE\" " "FROM \"PUBLIC\".\"VENUES\" " "WHERE \"PUBLIC\".\"VENUES\".\"PRICE\" < 3 " - "LIMIT 1048576")] + "LIMIT 1048575")] (mt/with-temp Card [card {:dataset_query mbql-query}] (is (= (i/->ReferencedCardQuery (:id card) expected-sql) (#'values/value-for-tag diff --git a/test/metabase/query_processor/middleware/catch_exceptions_test.clj b/test/metabase/query_processor/middleware/catch_exceptions_test.clj index dba825b639bb6dbc030e23afa2720db92aac0685..57a89e5565916537c03fcf5e447f1f329c61fc86 100644 --- a/test/metabase/query_processor/middleware/catch_exceptions_test.clj +++ b/test/metabase/query_processor/middleware/catch_exceptions_test.clj @@ -140,7 +140,7 @@ (perms/grant-native-readwrite-permissions! (group/all-users) (data/id)) ;; this is not actually a valid query (is (schema= {:native (s/eq {:query (str "SELECT parsedatetime(formatdatetime(\"PUBLIC\".\"VENUES\".\"ID\", 'yyyyMM'), 'yyyyMM') " - "AS \"ID\" FROM \"PUBLIC\".\"VENUES\" LIMIT 1048576") + "AS \"ID\" FROM \"PUBLIC\".\"VENUES\" LIMIT 1048575") :params nil}) :preprocessed (s/pred map?) s/Any s/Any} diff --git a/test/metabase/query_processor/middleware/fetch_source_query_test.clj b/test/metabase/query_processor/middleware/fetch_source_query_test.clj index 963b521268854746de9e0de1fe0c986ed01443c8..1d491e3a658815f767cbee38ded12bb4b83ccbf5 100644 --- a/test/metabase/query_processor/middleware/fetch_source_query_test.clj +++ b/test/metabase/query_processor/middleware/fetch_source_query_test.clj @@ -287,7 +287,7 @@ (let [query {:type :native :native {:projections ["_id" "user_id" "venue_id"], :query [{:$project {:_id "$_id"}} - {:$limit 1048576}] + {:$limit 1048575}] :collection "checkins" :mbql? true} :database (mt/id)}] diff --git a/test/metabase/query_processor/middleware/parameters_test.clj b/test/metabase/query_processor/middleware/parameters_test.clj index ba8eb0f93112f0a99f6e28ff0df4cf800c6e3716..2f476a2b07db07b304528c692d791cd2f216abb6 100644 --- a/test/metabase/query_processor/middleware/parameters_test.clj +++ b/test/metabase/query_processor/middleware/parameters_test.clj @@ -208,7 +208,7 @@ "\"PUBLIC\".\"VENUES\".\"LONGITUDE\" AS \"LONGITUDE\", " "\"PUBLIC\".\"VENUES\".\"PRICE\" AS \"PRICE\" " "FROM \"PUBLIC\".\"VENUES\" " - "LIMIT 1048576")] + "LIMIT 1048575")] (is (= (mt/native-query {:query (str "SELECT COUNT(*) FROM (SELECT * FROM (" card-1-subquery ") AS c1) AS c2") :params nil}) (substitute-params diff --git a/test/metabase/query_processor_test/explicit_joins_test.clj b/test/metabase/query_processor_test/explicit_joins_test.clj index a03de666205bf06313c22a8973c3185d2597b117..588331122d48524ede114447062cfe88a27e7730 100644 --- a/test/metabase/query_processor_test/explicit_joins_test.clj +++ b/test/metabase/query_processor_test/explicit_joins_test.clj @@ -23,7 +23,7 @@ "FROM \"PUBLIC\".\"VENUES\" " "LEFT JOIN \"PUBLIC\".\"CATEGORIES\" \"source\"" " ON \"PUBLIC\".\"VENUES\".\"CATEGORY_ID\" = 1 " - "LIMIT 1048576") + "LIMIT 1048575") (native-form (mt/mbql-query venues {:joins [{:source-table $$categories diff --git a/test/metabase/query_processor_test/failure_test.clj b/test/metabase/query_processor_test/failure_test.clj index 09d9184b75d0cf5d7e15c1d755df079b9aaa27d0..785cfaa3ccd4de4bdd21803fb604eaf47e382480 100644 --- a/test/metabase/query_processor_test/failure_test.clj +++ b/test/metabase/query_processor_test/failure_test.clj @@ -32,7 +32,7 @@ (def ^:private bad-query-native-schema {:query (s/eq (str "SELECT parsedatetime(formatdatetime(\"PUBLIC\".\"VENUES\".\"ID\", 'yyyyMM'), 'yyyyMM') AS \"ID\" " "FROM \"PUBLIC\".\"VENUES\" " - "LIMIT 1048576")) + "LIMIT 1048575")) :params (s/eq nil)}) (deftest process-userland-query-test diff --git a/test/metabase/query_processor_test/nested_queries_test.clj b/test/metabase/query_processor_test/nested_queries_test.clj index 1681a14a93bcdd3897bc0d3889687e0360b2587e..6abb5ca3162b5353cb8d93ee7b3029a4bb5afea6 100644 --- a/test/metabase/query_processor_test/nested_queries_test.clj +++ b/test/metabase/query_processor_test/nested_queries_test.clj @@ -358,7 +358,7 @@ (deftest native-query-with-default-params-as-source-test (testing "make sure using a native query with default params as a source works" - (is (= {:query "SELECT \"source\".* FROM (SELECT * FROM PRODUCTS WHERE CATEGORY = ? LIMIT 10) \"source\" LIMIT 1048576", + (is (= {:query "SELECT \"source\".* FROM (SELECT * FROM PRODUCTS WHERE CATEGORY = ? LIMIT 10) \"source\" LIMIT 1048575" :params ["Widget"]} (mt/with-temp Card [card {:dataset_query {:database (mt/id) :type :native diff --git a/test/metabase/query_processor_test/query_to_native_test.clj b/test/metabase/query_processor_test/query_to_native_test.clj index 4f07727d5ffe7e821f1cb856be2f9da679d75900..927f1445edbd0b4df8c82d35f238702616cb53a9 100644 --- a/test/metabase/query_processor_test/query_to_native_test.clj +++ b/test/metabase/query_processor_test/query_to_native_test.clj @@ -16,7 +16,7 @@ " \"PUBLIC\".\"VENUES\".\"LONGITUDE\" AS \"LONGITUDE\"," " \"PUBLIC\".\"VENUES\".\"PRICE\" AS \"PRICE\" " "FROM \"PUBLIC\".\"VENUES\" " - "LIMIT 1048576") + "LIMIT 1048575") :params nil} (qp/query->native (mt/mbql-query venues)))))) diff --git a/test/metabase/sync/sync_metadata/fields_test.clj b/test/metabase/sync/sync_metadata/fields_test.clj index f2cdefbcd06ea4f8585e2eb93137de2d962e6192..db6b4488d8f69499f21b45c7094218226f4265f5 100644 --- a/test/metabase/sync/sync_metadata/fields_test.clj +++ b/test/metabase/sync/sync_metadata/fields_test.clj @@ -110,10 +110,10 @@ (is (= {:before-sync (str "SELECT \"PUBLIC\".\"birds\".\"species\" AS \"species\", " "\"PUBLIC\".\"birds\".\"example_name\" AS \"example_name\" " "FROM \"PUBLIC\".\"birds\" " - "LIMIT 1048576") + "LIMIT 1048575") :after-sync (str "SELECT \"PUBLIC\".\"birds\".\"species\" AS \"species\" " "FROM \"PUBLIC\".\"birds\" " - "LIMIT 1048576")} + "LIMIT 1048575")} (with-test-db-before-and-after-altering "ALTER TABLE \"birds\" DROP COLUMN \"example_name\";" (fn [database]