Skip to content

Commit

Permalink
fix: max query size (#24148)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer authored Aug 5, 2024
1 parent 2408754 commit 472536a
Show file tree
Hide file tree
Showing 36 changed files with 1,263 additions and 2,468 deletions.

Large diffs are not rendered by default.

160 changes: 64 additions & 96 deletions posthog/api/test/__snapshots__/test_query.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -37,9 +36,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -59,9 +57,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -81,9 +78,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -103,9 +99,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -125,9 +120,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -143,9 +137,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -161,9 +154,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -179,9 +171,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -199,9 +190,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -219,9 +209,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -239,9 +228,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -263,9 +251,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -285,9 +272,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -307,9 +293,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -329,9 +314,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -351,9 +335,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -373,9 +356,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -395,9 +377,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -417,9 +398,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -439,9 +419,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand Down Expand Up @@ -479,9 +458,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand Down Expand Up @@ -519,9 +497,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -539,9 +516,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -560,9 +536,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -580,9 +555,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -601,9 +575,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -621,9 +594,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -642,9 +614,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -661,9 +632,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -681,9 +651,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
Expand All @@ -701,9 +670,8 @@
max_execution_time=60,
allow_experimental_object_type=1,
format_csv_allow_double_quotes=0,
max_ast_elements=2000000,
max_expanded_ast_elements=2000000,
max_query_size=1048576,
max_ast_elements=4000000,
max_expanded_ast_elements=4000000,
max_bytes_before_external_group_by=0
'''
# ---
3 changes: 3 additions & 0 deletions posthog/clickhouse/client/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def default_settings() -> dict:
return {
"join_algorithm": "direct,parallel_hash,hash",
"distributed_replica_max_ignored_errors": 1000,
# max_query_size can't be set in a query, because it determines the size of the buffer used to parse the query
# https://clickhouse.com/docs/en/operations/settings/settings#max_query_size
"max_query_size": 1048576,
}


Expand Down
Loading

0 comments on commit 472536a

Please sign in to comment.