diff --git a/contrib/google-protobuf-cmake/CMakeLists.txt b/contrib/google-protobuf-cmake/CMakeLists.txt
index 727121e60b5..dda6dfe85e4 100644
--- a/contrib/google-protobuf-cmake/CMakeLists.txt
+++ b/contrib/google-protobuf-cmake/CMakeLists.txt
@@ -385,9 +385,25 @@ endif ()
include("${ClickHouse_SOURCE_DIR}/contrib/google-protobuf-cmake/protobuf_generate.cmake")
+# These files needs to be installed to make it possible that users can use well-known protobuf types
+set(google_proto_files
+ ${protobuf_source_dir}/src/google/protobuf/any.proto
+ ${protobuf_source_dir}/src/google/protobuf/api.proto
+ ${protobuf_source_dir}/src/google/protobuf/descriptor.proto
+ ${protobuf_source_dir}/src/google/protobuf/duration.proto
+ ${protobuf_source_dir}/src/google/protobuf/empty.proto
+ ${protobuf_source_dir}/src/google/protobuf/field_mask.proto
+ ${protobuf_source_dir}/src/google/protobuf/source_context.proto
+ ${protobuf_source_dir}/src/google/protobuf/struct.proto
+ ${protobuf_source_dir}/src/google/protobuf/timestamp.proto
+ ${protobuf_source_dir}/src/google/protobuf/type.proto
+ ${protobuf_source_dir}/src/google/protobuf/wrappers.proto
+)
+
add_library(_protobuf INTERFACE)
target_link_libraries(_protobuf INTERFACE _libprotobuf)
target_include_directories(_protobuf INTERFACE "${Protobuf_INCLUDE_DIR}")
+set_target_properties(_protobuf PROPERTIES google_proto_files "${google_proto_files}")
add_library(ch_contrib::protobuf ALIAS _protobuf)
add_library(_protoc INTERFACE)
diff --git a/docs/en/sql-reference/data-types/lowcardinality.md b/docs/en/sql-reference/data-types/lowcardinality.md
index 7810f4c5324..db10103282d 100644
--- a/docs/en/sql-reference/data-types/lowcardinality.md
+++ b/docs/en/sql-reference/data-types/lowcardinality.md
@@ -56,7 +56,7 @@ Functions:
## Related content
-- [Reducing ClickHouse Storage Cost with the Low Cardinality Type – Lessons from an Instana Engineer](https://www.instana.com/blog/reducing-clickhouse-storage-cost-with-the-low-cardinality-type-lessons-from-an-instana-engineer/)
+- [Reducing ClickHouse Storage Cost with the Low Cardinality Type – Lessons from an Instana Engineer](https://altinity.com/blog/2020-5-20-reducing-clickhouse-storage-cost-with-the-low-cardinality-type-lessons-from-an-instana-engineer)
- [String Optimization (video presentation in Russian)](https://youtu.be/rqf-ILRgBdY?list=PL0Z2YDlm0b3iwXCpEFiOOYmwXzVmjJfEt). [Slides in English](https://github.com/ClickHouse/clickhouse-presentations/raw/master/meetup19/string_optimization.pdf)
- Blog: [Optimizing ClickHouse with Schemas and Codecs](https://clickhouse.com/blog/optimize-clickhouse-codecs-compression-schema)
- Blog: [Working with time series data in ClickHouse](https://clickhouse.com/blog/working-with-time-series-data-and-functions-ClickHouse)
diff --git a/docs/en/sql-reference/functions/date-time-functions.md b/docs/en/sql-reference/functions/date-time-functions.md
index 43f7c9cc61e..565486275e6 100644
--- a/docs/en/sql-reference/functions/date-time-functions.md
+++ b/docs/en/sql-reference/functions/date-time-functions.md
@@ -2533,13 +2533,14 @@ formatDateTime(Time, Format[, Timezone])
Returns time and date values according to the determined format.
**Replacement fields**
+
Using replacement fields, you can define a pattern for the resulting string. “Example” column shows formatting result for `2018-01-02 22:33:44`.
-| Placeholder | Description | Example |
+| Placeholder | Description | Example |
|----------|---------------------------------------------------------|------------|
| %a | abbreviated weekday name (Mon-Sun) | Mon |
| %b | abbreviated month name (Jan-Dec) | Jan |
-| %c | month as an integer number (01-12) | 01 |
+| %c | month as an integer number (01-12), see 'Note 3' below | 01 |
| %C | year divided by 100 and truncated to integer (00-99) | 20 |
| %d | day of the month, zero-padded (01-31) | 02 |
| %D | Short MM/DD/YY date, equivalent to %m/%d/%y | 01/02/18 |
@@ -2553,8 +2554,8 @@ Using replacement fields, you can define a pattern for the resulting string. “
| %i | minute (00-59) | 33 |
| %I | hour in 12h format (01-12) | 10 |
| %j | day of the year (001-366) | 002 |
-| %k | hour in 24h format (00-23) | 22 |
-| %l | hour in 12h format (01-12) | 09 |
+| %k | hour in 24h format (00-23), see 'Note 3' below | 14 |
+| %l | hour in 12h format (01-12), see 'Note 3' below | 09 |
| %m | month as an integer number (01-12) | 01 |
| %M | full month name (January-December), see 'Note 2' below | January |
| %n | new-line character (‘’) | |
@@ -2579,6 +2580,8 @@ Note 1: In ClickHouse versions earlier than v23.4, `%f` prints a single zero (0)
Note 2: In ClickHouse versions earlier than v23.4, `%M` prints the minute (00-59) instead of the full month name (January-December). The previous behavior can be restored using setting `formatdatetime_parsedatetime_m_is_month_name = 0`.
+Note 3: In ClickHouse versions earlier than v23.11, function `parseDateTime()` required leading zeros for formatters `%c` (month) and `%l`/`%k` (hour), e.g. `07`. In later versions, the leading zero may be omitted, e.g. `7`. The previous behavior can be restored using setting `parsedatetime_parse_without_leading_zeros = 0`. Note that function `formatDateTime()` by default still prints leading zeros for `%c` and `%l`/`%k` to not break existing use cases. This behavior can be changed by setting `formatdatetime_format_without_leading_zeros = 1`.
+
**Example**
``` sql
diff --git a/docs/en/sql-reference/functions/functions-for-nulls.md b/docs/en/sql-reference/functions/functions-for-nulls.md
index bde2a8a9505..91c04cfded3 100644
--- a/docs/en/sql-reference/functions/functions-for-nulls.md
+++ b/docs/en/sql-reference/functions/functions-for-nulls.md
@@ -164,7 +164,7 @@ Consider a list of contacts that may specify multiple ways to contact a customer
└──────────┴──────┴───────────┴───────────┘
```
-The `mail` and `phone` fields are of type String, but the `icq` field is `UInt32`, so it needs to be converted to `String`.
+The `mail` and `phone` fields are of type String, but the `telegram` field is `UInt32`, so it needs to be converted to `String`.
Get the first available contact method for the customer from the contact list:
diff --git a/docs/en/sql-reference/functions/other-functions.md b/docs/en/sql-reference/functions/other-functions.md
index 4c103274f43..b2a1d5066bb 100644
--- a/docs/en/sql-reference/functions/other-functions.md
+++ b/docs/en/sql-reference/functions/other-functions.md
@@ -67,7 +67,45 @@ WHERE macro = 'test';
│ test │ Value │
└───────┴──────────────┘
```
+
+## getClientHTTPHeader
+Returns the value of specified http header.If there is no such header or the request method is not http, it will throw an exception.
+**Syntax**
+
+```sql
+getClientHTTPHeader(name);
+```
+
+**Arguments**
+
+- `name` — HTTP header name .[String](../../sql-reference/data-types/string.md#string)
+
+**Returned value**
+
+Value of the specified header.
+Type:[String](../../sql-reference/data-types/string.md#string).
+
+
+When we use `clickhouse-client` to execute this function, we'll always get empty string, because client doesn't use http protocol.
+```sql
+SELECT getCientHTTPHeader('test')
+```
+result:
+
+```text
+┌─getClientHTTPHeader('test')─┐
+│ │
+└────────────------───────────┘
+```
+Try to use http request:
+```shell
+echo "select getClientHTTPHeader('X-Clickhouse-User')" | curl -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' 'http://localhost:8123/' -d @-
+
+#result
+default
+```
+
## FQDN
Returns the fully qualified domain name of the ClickHouse server.
diff --git a/docs/en/sql-reference/table-functions/fuzzJSON.md b/docs/en/sql-reference/table-functions/fuzzJSON.md
new file mode 100644
index 00000000000..74ccb0bcb8a
--- /dev/null
+++ b/docs/en/sql-reference/table-functions/fuzzJSON.md
@@ -0,0 +1,86 @@
+---
+slug: /en/sql-reference/table-functions/fuzzJSON
+sidebar_position: 75
+sidebar_label: fuzzJSON
+---
+
+# fuzzJSON
+
+Perturbs a JSON string with random variations.
+
+``` sql
+fuzzJSON({ named_collection [option=value [,..]] | json_str[, random_seed] })
+```
+
+**Arguments**
+
+- `named_collection`- A [NAMED COLLECTION](/docs/en/sql-reference/statements/create/named-collection.md).
+- `option=value` - Named collection optional parameters and their values.
+ - `json_str` (String) - The source string representing structured data in JSON format.
+ - `random_seed` (UInt64) - Manual random seed for producing stable results.
+ - `reuse_output` (boolean) - Reuse the output from a fuzzing process as input for the next fuzzer.
+ - `max_output_length` (UInt64) - Maximum allowable length of the generated or perturbed JSON string.
+ - `probability` (Float64) - The probability to fuzz a JSON field (a key-value pair). Must be within [0, 1] range.
+ - `max_nesting_level` (UInt64) - The maximum allowed depth of nested structures within the JSON data.
+ - `max_array_size` (UInt64) - The maximum allowed size of a JSON array.
+ - `max_object_size` (UInt64) - The maximum allowed number of fields on a single level of a JSON object.
+ - `max_string_value_length` (UInt64) - The maximum length of a String value.
+ - `min_key_length` (UInt64) - The minimum key length. Should be at least 1.
+ - `max_key_length` (UInt64) - The maximum key length. Should be greater or equal than the `min_key_length`, if specified.
+
+**Returned Value**
+
+A table object with a a single column containing perturbed JSON strings.
+
+## Usage Example
+
+``` sql
+CREATE NAMED COLLECTION json_fuzzer AS json_str='{}';
+SELECT * FROM fuzzJSON(json_fuzzer) LIMIT 3;
+```
+
+``` text
+{"52Xz2Zd4vKNcuP2":true}
+{"UPbOhOQAdPKIg91":3405264103600403024}
+{"X0QUWu8yT":[]}
+```
+
+``` sql
+SELECT * FROM fuzzJSON(json_fuzzer, json_str='{"name" : "value"}', random_seed=1234) LIMIT 3;
+```
+
+``` text
+{"key":"value", "mxPG0h1R5":"L-YQLv@9hcZbOIGrAn10%GA"}
+{"BRE3":true}
+{"key":"value", "SWzJdEJZ04nrpSfy":[{"3Q23y":[]}]}
+```
+
+``` sql
+SELECT * FROM fuzzJSON(json_fuzzer, json_str='{"students" : ["Alice", "Bob"]}', reuse_output=true) LIMIT 3;
+```
+
+``` text
+{"students":["Alice", "Bob"], "nwALnRMc4pyKD9Krv":[]}
+{"students":["1rNY5ZNs0wU&82t_P", "Bob"], "wLNRGzwDiMKdw":[{}]}
+{"xeEk":["1rNY5ZNs0wU&82t_P", "Bob"], "wLNRGzwDiMKdw":[{}, {}]}
+```
+
+``` sql
+SELECT * FROM fuzzJSON(json_fuzzer, json_str='{"students" : ["Alice", "Bob"]}', max_output_length=512) LIMIT 3;
+```
+
+``` text
+{"students":["Alice", "Bob"], "BREhhXj5":true}
+{"NyEsSWzJdeJZ04s":["Alice", 5737924650575683711, 5346334167565345826], "BjVO2X9L":true}
+{"NyEsSWzJdeJZ04s":["Alice", 5737924650575683711, 5346334167565345826], "BjVO2X9L":true, "k1SXzbSIz":[{}]}
+```
+
+``` sql
+SELECT * FROM fuzzJSON('{"id":1}', 1234) LIMIT 3;
+```
+
+``` text
+{"id":1, "mxPG0h1R5":"L-YQLv@9hcZbOIGrAn10%GA"}
+{"BRjE":16137826149911306846}
+{"XjKE":15076727133550123563}
+```
diff --git a/packages/clickhouse-common-static.yaml b/packages/clickhouse-common-static.yaml
index 95532726d94..238126f95fd 100644
--- a/packages/clickhouse-common-static.yaml
+++ b/packages/clickhouse-common-static.yaml
@@ -44,6 +44,8 @@ contents:
dst: /usr/bin/clickhouse-odbc-bridge
- src: root/usr/share/bash-completion/completions
dst: /usr/share/bash-completion/completions
+- src: root/usr/share/clickhouse
+ dst: /usr/share/clickhouse
# docs
- src: ../AUTHORS
dst: /usr/share/doc/clickhouse-common-static/AUTHORS
diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt
index f17aff65fb5..b3a5af6d6c9 100644
--- a/programs/CMakeLists.txt
+++ b/programs/CMakeLists.txt
@@ -457,3 +457,10 @@ endif()
if (ENABLE_FUZZING)
add_compile_definitions(FUZZING_MODE=1)
endif ()
+
+if (TARGET ch_contrib::protobuf)
+ get_property(google_proto_files TARGET ch_contrib::protobuf PROPERTY google_proto_files)
+ foreach (proto_file IN LISTS google_proto_files)
+ install(FILES ${proto_file} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/clickhouse/protos/google/protobuf)
+ endforeach()
+endif ()
diff --git a/programs/client/Client.cpp b/programs/client/Client.cpp
index d2527ad0c98..3233e40de31 100644
--- a/programs/client/Client.cpp
+++ b/programs/client/Client.cpp
@@ -306,6 +306,10 @@ void Client::initialize(Poco::Util::Application & self)
/// Set path for format schema files
if (config().has("format_schema_path"))
global_context->setFormatSchemaPath(fs::weakly_canonical(config().getString("format_schema_path")));
+
+ /// Set the path for google proto files
+ if (config().has("google_protos_path"))
+ global_context->setGoogleProtosPath(fs::weakly_canonical(config().getString("google_protos_path")));
}
diff --git a/programs/client/clickhouse-client.xml b/programs/client/clickhouse-client.xml
index dbfb267d778..d0deb818c1e 100644
--- a/programs/client/clickhouse-client.xml
+++ b/programs/client/clickhouse-client.xml
@@ -37,7 +37,7 @@
{display_name} \e[1;31m:)\e[0m
-
+
+ /usr/share/clickhouse/protos/
setHTTPHeaderFilter(*config);
global_context->setMaxTableSizeToDrop(server_settings_.max_table_size_to_drop);
+ global_context->setClientHTTPHeaderForbiddenHeaders(server_settings_.get_client_http_header_forbidden_headers);
+ global_context->setAllowGetHTTPHeaderFunction(server_settings_.allow_get_client_http_header);
global_context->setMaxPartitionSizeToDrop(server_settings_.max_partition_size_to_drop);
ConcurrencyControl::SlotCount concurrent_threads_soft_limit = ConcurrencyControl::Unlimited;
@@ -1575,6 +1577,10 @@ try
global_context->setFormatSchemaPath(format_schema_path);
fs::create_directories(format_schema_path);
+ /// Set the path for google proto files
+ if (config().has("google_protos_path"))
+ global_context->setGoogleProtosPath(fs::weakly_canonical(config().getString("google_protos_path")));
+
/// Set path for filesystem caches
fs::path filesystem_caches_path(config().getString("filesystem_caches_path", ""));
if (!filesystem_caches_path.empty())
diff --git a/programs/server/config.d/path.xml b/programs/server/config.d/path.xml
index 46af5bfb64b..7afada689d7 100644
--- a/programs/server/config.d/path.xml
+++ b/programs/server/config.d/path.xml
@@ -3,6 +3,7 @@
./tmp/
./user_files/
./format_schemas/
+ ../../contrib/google-protobuf/src/
./access/
./top_level_domains/
diff --git a/programs/server/config.xml b/programs/server/config.xml
index f81fbe9cc3b..f367b97cec1 100644
--- a/programs/server/config.xml
+++ b/programs/server/config.xml
@@ -1428,6 +1428,10 @@
-->
/var/lib/clickhouse/format_schemas/
+
+ /usr/share/clickhouse/protos/
+
10
+
+
+ /usr/share/clickhouse/protos/
+
diff --git a/tests/config/config.d/forbidden_get_client_http_headers.xml b/tests/config/config.d/forbidden_get_client_http_headers.xml
new file mode 100644
index 00000000000..cfecb015260
--- /dev/null
+++ b/tests/config/config.d/forbidden_get_client_http_headers.xml
@@ -0,0 +1,4 @@
+
+ FORBIDDEN-KEY1,FORBIDDEN-KEY2
+ 1
+
diff --git a/tests/config/install.sh b/tests/config/install.sh
index 417a413bbec..96f35219bc6 100755
--- a/tests/config/install.sh
+++ b/tests/config/install.sh
@@ -15,6 +15,7 @@ mkdir -p $DEST_SERVER_PATH/config.d/
mkdir -p $DEST_SERVER_PATH/users.d/
mkdir -p $DEST_CLIENT_PATH
+ln -sf $SRC_PATH/config.d/forbidden_get_client_http_headers.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/zookeeper_write.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/listen.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/text_log.xml $DEST_SERVER_PATH/config.d/
diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py
index cbc511628f0..5e4bb32cf94 100644
--- a/tests/integration/helpers/cluster.py
+++ b/tests/integration/helpers/cluster.py
@@ -4130,14 +4130,14 @@ class ClickHouseInstance:
[
"bash",
"-c",
- "echo 'ATTACH DATABASE system ENGINE=Ordinary' > /var/lib/clickhouse/metadata/system.sql",
+ "if [ ! -f /var/lib/clickhouse/metadata/system.sql ]; then echo 'ATTACH DATABASE system ENGINE=Ordinary' > /var/lib/clickhouse/metadata/system.sql; fi",
]
)
self.exec_in_container(
[
"bash",
"-c",
- "echo 'ATTACH DATABASE system ENGINE=Ordinary' > /var/lib/clickhouse/metadata/default.sql",
+ "if [ ! -f /var/lib/clickhouse/metadata/default.sql ]; then echo 'ATTACH DATABASE system ENGINE=Ordinary' > /var/lib/clickhouse/metadata/default.sql; fi",
]
)
self.exec_in_container(
diff --git a/tests/integration/helpers/corrupt_part_data_on_disk.py b/tests/integration/helpers/corrupt_part_data_on_disk.py
index e253ce23d83..a84a6e825e6 100644
--- a/tests/integration/helpers/corrupt_part_data_on_disk.py
+++ b/tests/integration/helpers/corrupt_part_data_on_disk.py
@@ -1,19 +1,21 @@
-def corrupt_part_data_on_disk(node, table, part_name):
+def corrupt_part_data_on_disk(node, table, part_name, file_ext=".bin", database=None):
part_path = node.query(
- "SELECT path FROM system.parts WHERE table = '{}' and name = '{}'".format(
- table, part_name
+ "SELECT path FROM system.parts WHERE table = '{}' and name = '{}' {}".format(
+ table,
+ part_name,
+ f"AND database = '{database}'" if database is not None else "",
)
).strip()
- corrupt_part_data_by_path(node, part_path)
+ corrupt_part_data_by_path(node, part_path, file_ext)
-def corrupt_part_data_by_path(node, part_path):
+def corrupt_part_data_by_path(node, part_path, file_ext=".bin"):
print("Corrupting part", part_path, "at", node.name)
print(
"Will corrupt: ",
node.exec_in_container(
- ["bash", "-c", "cd {p} && ls *.bin | head -n 1".format(p=part_path)]
+ ["bash", "-c", f"cd {part_path} && ls *{file_ext} | head -n 1"]
),
)
@@ -21,9 +23,7 @@ def corrupt_part_data_by_path(node, part_path):
[
"bash",
"-c",
- "cd {p} && ls *.bin | head -n 1 | xargs -I{{}} sh -c 'echo \"1\" >> $1' -- {{}}".format(
- p=part_path
- ),
+ f"cd {part_path} && ls *{file_ext} | head -n 1 | xargs -I{{}} sh -c 'truncate -s -1 $1' -- {{}}",
],
privileged=True,
)
diff --git a/tests/integration/test_check_table/test.py b/tests/integration/test_check_table/test.py
index 70cadbc97e2..021977fb6b6 100644
--- a/tests/integration/test_check_table/test.py
+++ b/tests/integration/test_check_table/test.py
@@ -3,6 +3,7 @@ import pytest
import concurrent
from helpers.cluster import ClickHouseCluster
from helpers.client import QueryRuntimeException
+from helpers.corrupt_part_data_on_disk import corrupt_part_data_on_disk
cluster = ClickHouseCluster(__file__)
@@ -21,22 +22,6 @@ def started_cluster():
cluster.shutdown()
-def corrupt_data_part_on_disk(node, database, table, part_name):
- part_path = node.query(
- f"SELECT path FROM system.parts WHERE database = '{database}' AND table = '{table}' AND name = '{part_name}'"
- ).strip()
- node.exec_in_container(
- [
- "bash",
- "-c",
- "cd {p} && ls *.bin | head -n 1 | xargs -I{{}} sh -c 'echo \"1\" >> $1' -- {{}}".format(
- p=part_path
- ),
- ],
- privileged=True,
- )
-
-
def remove_checksums_on_disk(node, database, table, part_name):
part_path = node.query(
f"SELECT path FROM system.parts WHERE database = '{database}' AND table = '{table}' AND name = '{part_name}'"
@@ -59,14 +44,15 @@ def remove_part_from_disk(node, table, part_name):
)
-def test_check_normal_table_corruption(started_cluster):
+@pytest.mark.parametrize("merge_tree_settings", [""])
+def test_check_normal_table_corruption(started_cluster, merge_tree_settings):
node1.query("DROP TABLE IF EXISTS non_replicated_mt")
node1.query(
- """
+ f"""
CREATE TABLE non_replicated_mt(date Date, id UInt32, value Int32)
ENGINE = MergeTree() PARTITION BY toYYYYMM(date) ORDER BY id
- SETTINGS min_bytes_for_wide_part=0;
+ {merge_tree_settings};
"""
)
@@ -105,7 +91,9 @@ def test_check_normal_table_corruption(started_cluster):
assert node1.query("SELECT COUNT() FROM non_replicated_mt") == "2\n"
- corrupt_data_part_on_disk(node1, "default", "non_replicated_mt", "201902_1_1_0")
+ corrupt_part_data_on_disk(
+ node1, "non_replicated_mt", "201902_1_1_0", database="default"
+ )
assert node1.query(
"CHECK TABLE non_replicated_mt",
@@ -129,7 +117,9 @@ def test_check_normal_table_corruption(started_cluster):
== "201901_2_2_0\t1\t\n"
)
- corrupt_data_part_on_disk(node1, "default", "non_replicated_mt", "201901_2_2_0")
+ corrupt_part_data_on_disk(
+ node1, "non_replicated_mt", "201901_2_2_0", database="default"
+ )
remove_checksums_on_disk(node1, "default", "non_replicated_mt", "201901_2_2_0")
@@ -139,16 +129,23 @@ def test_check_normal_table_corruption(started_cluster):
).strip().split("\t")[0:2] == ["201901_2_2_0", "0"]
-def test_check_replicated_table_simple(started_cluster):
+@pytest.mark.parametrize("merge_tree_settings, zk_path_suffix", [("", "_0")])
+def test_check_replicated_table_simple(
+ started_cluster, merge_tree_settings, zk_path_suffix
+):
for node in [node1, node2]:
- node.query("DROP TABLE IF EXISTS replicated_mt")
+ node.query("DROP TABLE IF EXISTS replicated_mt SYNC")
node.query(
"""
CREATE TABLE replicated_mt(date Date, id UInt32, value Int32)
- ENGINE = ReplicatedMergeTree('/clickhouse/tables/replicated_mt', '{replica}') PARTITION BY toYYYYMM(date) ORDER BY id;
+ ENGINE = ReplicatedMergeTree('/clickhouse/tables/replicated_mt_{zk_path_suffix}', '{replica}')
+ PARTITION BY toYYYYMM(date) ORDER BY id
+ {merge_tree_settings}
""".format(
- replica=node.name
+ replica=node.name,
+ zk_path_suffix=zk_path_suffix,
+ merge_tree_settings=merge_tree_settings,
)
)
@@ -220,16 +217,32 @@ def test_check_replicated_table_simple(started_cluster):
)
-def test_check_replicated_table_corruption(started_cluster):
+@pytest.mark.parametrize(
+ "merge_tree_settings, zk_path_suffix, part_file_ext",
+ [
+ (
+ "",
+ "_0",
+ ".bin",
+ )
+ ],
+)
+def test_check_replicated_table_corruption(
+ started_cluster, merge_tree_settings, zk_path_suffix, part_file_ext
+):
for node in [node1, node2]:
- node.query_with_retry("DROP TABLE IF EXISTS replicated_mt_1")
+ node.query_with_retry("DROP TABLE IF EXISTS replicated_mt_1 SYNC")
node.query_with_retry(
"""
CREATE TABLE replicated_mt_1(date Date, id UInt32, value Int32)
- ENGINE = ReplicatedMergeTree('/clickhouse/tables/replicated_mt_1', '{replica}') PARTITION BY toYYYYMM(date) ORDER BY id;
+ ENGINE = ReplicatedMergeTree('/clickhouse/tables/replicated_mt_1_{zk_path_suffix}', '{replica}')
+ PARTITION BY toYYYYMM(date) ORDER BY id
+ {merge_tree_settings}
""".format(
- replica=node.name
+ replica=node.name,
+ merge_tree_settings=merge_tree_settings,
+ zk_path_suffix=zk_path_suffix,
)
)
@@ -248,7 +261,10 @@ def test_check_replicated_table_corruption(started_cluster):
"SELECT name from system.parts where table = 'replicated_mt_1' and partition_id = '201901' and active = 1"
).strip()
- corrupt_data_part_on_disk(node1, "default", "replicated_mt_1", part_name)
+ corrupt_part_data_on_disk(
+ node1, "replicated_mt_1", part_name, part_file_ext, database="default"
+ )
+
assert node1.query(
"CHECK TABLE replicated_mt_1 PARTITION 201901",
settings={"check_query_single_value_result": 0, "max_threads": 1},
diff --git a/tests/integration/test_keeper_memory_soft_limit/configs/enable_keeper.xml b/tests/integration/test_keeper_memory_soft_limit/configs/enable_keeper.xml
index a3217b34501..c289ea23d64 100644
--- a/tests/integration/test_keeper_memory_soft_limit/configs/enable_keeper.xml
+++ b/tests/integration/test_keeper_memory_soft_limit/configs/enable_keeper.xml
@@ -11,6 +11,7 @@
5000
10000
trace
+ 10000000
0
diff --git a/tests/integration/test_keeper_memory_soft_limit/test.py b/tests/integration/test_keeper_memory_soft_limit/test.py
index 4114b513864..a90342fb069 100644
--- a/tests/integration/test_keeper_memory_soft_limit/test.py
+++ b/tests/integration/test_keeper_memory_soft_limit/test.py
@@ -45,12 +45,12 @@ def test_soft_limit_create(started_cluster):
keeper_utils.wait_until_connected(started_cluster, node)
try:
node_zk = get_connection_zk("node")
- loop_time = 1000000
+ loop_time = 10000
node_zk.create("/test_soft_limit", b"abc")
for i in range(loop_time):
node_zk.create(
- "/test_soft_limit/node_" + str(i), random_string(100).encode()
+ "/test_soft_limit/node_" + str(i), random_string(1000).encode()
)
except ConnectionLoss:
txn = node_zk.transaction()
diff --git a/tests/integration/test_replicated_database/test.py b/tests/integration/test_replicated_database/test.py
index f45841124d9..a591c93d264 100644
--- a/tests/integration/test_replicated_database/test.py
+++ b/tests/integration/test_replicated_database/test.py
@@ -1351,3 +1351,48 @@ def test_replicated_table_structure_alter(started_cluster):
assert "1\t2\t3\t0\n1\t2\t3\t4\n" == dummy_node.query(
"SELECT * FROM table_structure.rmt ORDER BY k"
)
+
+
+def test_modify_comment(started_cluster):
+ main_node.query(
+ "CREATE DATABASE modify_comment_db ENGINE = Replicated('/test/modify_comment', 'shard1', 'replica' || '1');"
+ )
+
+ dummy_node.query(
+ "CREATE DATABASE modify_comment_db ENGINE = Replicated('/test/modify_comment', 'shard1', 'replica' || '2');"
+ )
+
+ main_node.query(
+ "CREATE TABLE modify_comment_db.modify_comment_table (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree ORDER BY k PARTITION BY toYYYYMM(d);"
+ )
+
+ def restart_verify_not_readonly():
+ main_node.restart_clickhouse()
+ assert (
+ main_node.query(
+ "SELECT is_readonly FROM system.replicas WHERE table = 'modify_comment_table'"
+ )
+ == "0\n"
+ )
+ dummy_node.restart_clickhouse()
+ assert (
+ dummy_node.query(
+ "SELECT is_readonly FROM system.replicas WHERE table = 'modify_comment_table'"
+ )
+ == "0\n"
+ )
+
+ main_node.query(
+ "ALTER TABLE modify_comment_db.modify_comment_table COMMENT COLUMN d 'Some comment'"
+ )
+
+ restart_verify_not_readonly()
+
+ main_node.query(
+ "ALTER TABLE modify_comment_db.modify_comment_table MODIFY COMMENT 'Some error comment'"
+ )
+
+ restart_verify_not_readonly()
+
+ main_node.query("DROP DATABASE modify_comment_db SYNC")
+ dummy_node.query("DROP DATABASE modify_comment_db SYNC")
diff --git a/tests/queries/0_stateless/00184_shard_distributed_group_by_no_merge.sql b/tests/queries/0_stateless/00184_shard_distributed_group_by_no_merge.sql
index 965ce45fb90..422f4a010f1 100644
--- a/tests/queries/0_stateless/00184_shard_distributed_group_by_no_merge.sql
+++ b/tests/queries/0_stateless/00184_shard_distributed_group_by_no_merge.sql
@@ -8,8 +8,6 @@ SELECT count(), uniq(dummy) FROM remote('127.0.0.{2,3}', system.one) LIMIT 1 SET
SELECT 'distributed_group_by_no_merge=2';
SET max_distributed_connections=1;
SET max_threads=1;
--- breaks any(_shard_num)
-SET optimize_move_functions_out_of_any=0;
SELECT 'LIMIT';
SELECT * FROM (SELECT any(_shard_num) shard_num, count(), uniq(dummy) FROM remote('127.0.0.{2,3}', system.one)) ORDER BY shard_num LIMIT 1 SETTINGS distributed_group_by_no_merge=2;
diff --git a/tests/queries/0_stateless/00718_format_datetime.reference b/tests/queries/0_stateless/00718_format_datetime.reference
index 50874ac9b2e..f22c953e739 100644
--- a/tests/queries/0_stateless/00718_format_datetime.reference
+++ b/tests/queries/0_stateless/00718_format_datetime.reference
@@ -64,3 +64,13 @@ no formatting pattern no formatting pattern
2022-12-08 18:11:29.000000
2022-12-08 00:00:00.000000
2022-12-08 00:00:00.000000
+01
+01
+02
+02
+02
+1
+01
+2
+2
+02
diff --git a/tests/queries/0_stateless/00718_format_datetime.sql b/tests/queries/0_stateless/00718_format_datetime.sql
index c0db6a4f64e..4f2ce70965b 100644
--- a/tests/queries/0_stateless/00718_format_datetime.sql
+++ b/tests/queries/0_stateless/00718_format_datetime.sql
@@ -90,3 +90,15 @@ select formatDateTime(toDateTime64('2022-12-08 18:11:29.1234', 0, 'UTC'), '%F %T
select formatDateTime(toDateTime('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
select formatDateTime(toDate32('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
select formatDateTime(toDate('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
+
+-- %c %k %l with different formatdatetime_format_without_leading_zeros
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%c') settings formatdatetime_format_without_leading_zeros = 0;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%m') settings formatdatetime_format_without_leading_zeros = 0;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%k') settings formatdatetime_format_without_leading_zeros = 0;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%l') settings formatdatetime_format_without_leading_zeros = 0;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%h') settings formatdatetime_format_without_leading_zeros = 0;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%c') settings formatdatetime_format_without_leading_zeros = 1;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%m') settings formatdatetime_format_without_leading_zeros = 1;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%k') settings formatdatetime_format_without_leading_zeros = 1;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%l') settings formatdatetime_format_without_leading_zeros = 1;
+select formatDateTime(toDateTime('2022-01-08 02:11:29', 'UTC'), '%h') settings formatdatetime_format_without_leading_zeros = 1;
diff --git a/tests/queries/0_stateless/01111_create_drop_replicated_db_stress.sh b/tests/queries/0_stateless/01111_create_drop_replicated_db_stress.sh
index f61a60a0bda..8ebe1807a1b 100755
--- a/tests/queries/0_stateless/01111_create_drop_replicated_db_stress.sh
+++ b/tests/queries/0_stateless/01111_create_drop_replicated_db_stress.sh
@@ -69,7 +69,7 @@ function alter_table()
if [ -z "$table" ]; then continue; fi
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=0 -q \
"alter table $table update n = n + (select max(n) from merge(REGEXP('${CLICKHOUSE_DATABASE}.*'), '.*')) where 1 settings allow_nondeterministic_mutations=1" \
- 2>&1| grep -Fa "Exception: " | grep -Fv "Cannot enqueue query" | grep -Fv "ZooKeeper session expired" | grep -Fv UNKNOWN_DATABASE | grep -Fv UNKNOWN_TABLE | grep -Fv TABLE_IS_READ_ONLY | grep -Fv TABLE_IS_DROPPED | grep -Fv "Error while executing table function merge"
+ 2>&1| grep -Fa "Exception: " | grep -Fv "Cannot enqueue query" | grep -Fv "ZooKeeper session expired" | grep -Fv UNKNOWN_DATABASE | grep -Fv UNKNOWN_TABLE | grep -Fv TABLE_IS_READ_ONLY | grep -Fv TABLE_IS_DROPPED | grep -Fv ABORTED | grep -Fv "Error while executing table function merge"
sleep 0.$RANDOM
done
}
diff --git a/tests/queries/0_stateless/01321_aggregate_functions_of_group_by_keys.sql b/tests/queries/0_stateless/01321_aggregate_functions_of_group_by_keys.sql
index 2937e856bf5..3f08936e636 100644
--- a/tests/queries/0_stateless/01321_aggregate_functions_of_group_by_keys.sql
+++ b/tests/queries/0_stateless/01321_aggregate_functions_of_group_by_keys.sql
@@ -1,5 +1,4 @@
set optimize_aggregators_of_group_by_keys = 1;
-set optimize_move_functions_out_of_any = 0;
SELECT min(number % 2) AS a, max(number % 3) AS b FROM numbers(10000000) GROUP BY number % 2, number % 3 ORDER BY a, b;
SELECT any(number % 2) AS a, anyLast(number % 3) AS b FROM numbers(10000000) GROUP BY number % 2, number % 3 ORDER BY a, b;
diff --git a/tests/queries/0_stateless/01322_any_input_optimize.reference b/tests/queries/0_stateless/01322_any_input_optimize.reference
deleted file mode 100644
index f88f2f5937c..00000000000
--- a/tests/queries/0_stateless/01322_any_input_optimize.reference
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT any(number) + (any(number) * 2)
-FROM numbers(1, 2)
-3
-SELECT anyLast(number) + (anyLast(number) * 2)
-FROM numbers(1, 2)
-6
-WITH any(number) * 3 AS x
-SELECT x
-FROM numbers(1, 2)
-3
-SELECT
- anyLast(number) * 3 AS x,
- x
-FROM numbers(1, 2)
-6 6
-SELECT any(number + (number * 2))
-FROM numbers(1, 2)
-3
-SELECT anyLast(number + (number * 2))
-FROM numbers(1, 2)
-6
-WITH any(number * 3) AS x
-SELECT x
-FROM numbers(1, 2)
-3
-SELECT
- anyLast(number * 3) AS x,
- x
-FROM numbers(1, 2)
-6 6
-arrayJoin
-0 []
diff --git a/tests/queries/0_stateless/01322_any_input_optimize.sql b/tests/queries/0_stateless/01322_any_input_optimize.sql
deleted file mode 100644
index 4c3345f4be4..00000000000
--- a/tests/queries/0_stateless/01322_any_input_optimize.sql
+++ /dev/null
@@ -1,34 +0,0 @@
-SET optimize_move_functions_out_of_any = 1;
-
-EXPLAIN SYNTAX SELECT any(number + number * 2) FROM numbers(1, 2);
-SELECT any(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN SYNTAX SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN SYNTAX WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-
-EXPLAIN SYNTAX SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
-
-SET optimize_move_functions_out_of_any = 0;
-
-EXPLAIN SYNTAX SELECT any(number + number * 2) FROM numbers(1, 2);
-SELECT any(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN SYNTAX SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN SYNTAX WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-
-EXPLAIN SYNTAX SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
-
-SELECT 'arrayJoin';
-SELECT *, any(arrayJoin([[], []])) FROM numbers(1) GROUP BY number;
diff --git a/tests/queries/0_stateless/01398_any_with_alias.reference b/tests/queries/0_stateless/01398_any_with_alias.reference
deleted file mode 100644
index 4f8e72ef29c..00000000000
--- a/tests/queries/0_stateless/01398_any_with_alias.reference
+++ /dev/null
@@ -1,8 +0,0 @@
-"n"
-0
-SELECT any(number) * any(number) AS n
-FROM numbers(100)
-"n"
-0,0
-SELECT (any(number), any(number) * 2) AS n
-FROM numbers(100)
diff --git a/tests/queries/0_stateless/01398_any_with_alias.sql b/tests/queries/0_stateless/01398_any_with_alias.sql
deleted file mode 100644
index a65b8132c67..00000000000
--- a/tests/queries/0_stateless/01398_any_with_alias.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-SET optimize_move_functions_out_of_any = 1;
-
-SELECT any(number * number) AS n FROM numbers(100) FORMAT CSVWithNames;
-EXPLAIN SYNTAX SELECT any(number * number) AS n FROM numbers(100);
-
-SELECT any((number, number * 2)) as n FROM numbers(100) FORMAT CSVWithNames;
-EXPLAIN SYNTAX SELECT any((number, number * 2)) as n FROM numbers(100);
diff --git a/tests/queries/0_stateless/01414_optimize_any_bug.reference b/tests/queries/0_stateless/01414_optimize_any_bug.reference
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/queries/0_stateless/01414_optimize_any_bug.sql b/tests/queries/0_stateless/01414_optimize_any_bug.sql
deleted file mode 100644
index ec24a09fc11..00000000000
--- a/tests/queries/0_stateless/01414_optimize_any_bug.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-DROP TABLE IF EXISTS test;
-
-CREATE TABLE test
-(
- `Source.C1` Array(UInt64),
- `Source.C2` Array(UInt64)
-)
-ENGINE = MergeTree()
-ORDER BY tuple();
-
-SET enable_positional_arguments=0;
-SET optimize_move_functions_out_of_any = 1;
-
-SELECT any(arrayFilter((c, d) -> (4 = d), `Source.C1`, `Source.C2`)[1]) AS x
-FROM test
-WHERE 0
-GROUP BY 42;
-
-DROP TABLE test;
diff --git a/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.reference b/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.reference
index 8c76b239991..1fb8df14afc 100644
--- a/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.reference
+++ b/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.reference
@@ -1,10 +1,8 @@
1
1
-1
other
google
1
-1
2
other
other
diff --git a/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.sql b/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.sql
index 1e1d87a5ad5..91044859c1c 100644
--- a/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.sql
+++ b/tests/queries/0_stateless/01456_ast_optimizations_over_distributed.sql
@@ -1,11 +1,9 @@
-- Tags: distributed
-SET optimize_move_functions_out_of_any = 1;
SET optimize_injective_functions_inside_uniq = 1;
SET optimize_arithmetic_operations_in_aggregate_functions = 1;
SET optimize_if_transform_strings_to_enum = 1;
-SELECT any(number + 1) FROM numbers(1);
SELECT uniq(bitNot(number)) FROM numbers(1);
SELECT sum(number + 1) FROM numbers(1);
SELECT transform(number, [1, 2], ['google', 'censor.net'], 'other') FROM numbers(1);
@@ -20,7 +18,6 @@ CREATE TABLE dist AS local_table ENGINE = Distributed(test_cluster_two_shards_lo
INSERT INTO local_table SELECT number FROM numbers(1);
-SELECT any(number + 1) FROM dist;
SELECT uniq(bitNot(number)) FROM dist;
SELECT sum(number + 1) FROM dist;
SELECT transform(number, [1, 2], ['google', 'censor.net'], 'other') FROM dist;
diff --git a/tests/queries/0_stateless/01650_any_null_if.reference b/tests/queries/0_stateless/01650_any_null_if.reference
deleted file mode 100644
index e965047ad7c..00000000000
--- a/tests/queries/0_stateless/01650_any_null_if.reference
+++ /dev/null
@@ -1 +0,0 @@
-Hello
diff --git a/tests/queries/0_stateless/01650_any_null_if.sql b/tests/queries/0_stateless/01650_any_null_if.sql
deleted file mode 100644
index 17f57e92032..00000000000
--- a/tests/queries/0_stateless/01650_any_null_if.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-SELECT any(nullIf(s, '')) FROM (SELECT arrayJoin(['', 'Hello']) AS s);
-
-SET optimize_move_functions_out_of_any = 0;
-EXPLAIN SYNTAX select any(nullIf('', ''), 'some text'); -- { serverError 42 }
-SET optimize_move_functions_out_of_any = 1;
-EXPLAIN SYNTAX select any(nullIf('', ''), 'some text'); -- { serverError 42 }
diff --git a/tests/queries/0_stateless/02266_protobuf_format_google_wrappers.sh b/tests/queries/0_stateless/02266_protobuf_format_google_wrappers.sh
index 9654d3146e2..ae2a2351c6b 100755
--- a/tests/queries/0_stateless/02266_protobuf_format_google_wrappers.sh
+++ b/tests/queries/0_stateless/02266_protobuf_format_google_wrappers.sh
@@ -90,7 +90,7 @@ hexdump -C $BINARY_FILE_PATH
echo
echo "Decoded with protoc:"
-(cd $SCHEMADIR && $PROTOC_BINARY --decode Message "$PROTOBUF_FILE_NAME".proto) < $BINARY_FILE_PATH
+(cd $SCHEMADIR && $PROTOC_BINARY --proto_path=. --proto_path=/usr/share/clickhouse/protos --decode Message "$PROTOBUF_FILE_NAME".proto) < $BINARY_FILE_PATH
echo
echo "Proto message with wrapper for (NULL, 1), ('', 2), ('str', 3):"
diff --git a/tests/queries/0_stateless/02415_all_new_functions_must_be_documented.reference b/tests/queries/0_stateless/02415_all_new_functions_must_be_documented.reference
index 379eea4dbbb..7bb0b965fbc 100644
--- a/tests/queries/0_stateless/02415_all_new_functions_must_be_documented.reference
+++ b/tests/queries/0_stateless/02415_all_new_functions_must_be_documented.reference
@@ -320,6 +320,7 @@ geoDistance
geohashDecode
geohashEncode
geohashesInBox
+getClientHTTPHeader
getMacro
getOSKernelVersion
getServerPort
diff --git a/tests/queries/0_stateless/02668_parse_datetime.reference b/tests/queries/0_stateless/02668_parse_datetime.reference
index f6c53ce1887..d21a51ce70c 100644
--- a/tests/queries/0_stateless/02668_parse_datetime.reference
+++ b/tests/queries/0_stateless/02668_parse_datetime.reference
@@ -243,3 +243,30 @@ select parseDateTime('12 AM'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH
select parseDateTime('12 AM', '%h %p', 'UTC', 'a fourth argument'); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
-- Fuzzer crash bug #53715
select parseDateTime('', '', toString(number)) from numbers(13); -- { serverError ILLEGAL_COLUMN }
+-- %h
+select parseDateTime('Aug 13, 2022, 7:58:32 PM', '%b %e, %G, %h:%i:%s %p', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('Aug 13, 2022, 07:58:32 PM', '%b %e, %G, %h:%i:%s %p', 'UTC');
+2022-08-13 19:58:32
+-- %l accepts single or double digits inputs
+select parseDateTime('Aug 13, 2022, 7:58:32 PM', '%b %e, %G, %l:%i:%s %p', 'UTC');
+2022-08-13 19:58:32
+select parseDateTime('Aug 13, 2022, 07:58:32 PM', '%b %e, %G, %l:%i:%s %p', 'UTC');
+2022-08-13 19:58:32
+-- %H
+select parseDateTime('Aug 13, 2022, 7:58:32', '%b %e, %G, %H:%i:%s', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('Aug 13, 2022, 07:58:32', '%b %e, %G, %H:%i:%s', 'UTC');
+2022-08-13 07:58:32
+-- %k accepts single or double digits inputs
+select parseDateTime('Aug 13, 2022, 7:58:32', '%b %e, %G, %k:%i:%s', 'UTC');
+2022-08-13 07:58:32
+select parseDateTime('Aug 13, 2022, 07:58:32', '%b %e, %G, %k:%i:%s', 'UTC');
+2022-08-13 07:58:32
+-- %m
+select parseDateTime('8 13, 2022, 7:58:32', '%m %e, %G, %k:%i:%s', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('08 13, 2022, 07:58:32', '%m %e, %G, %k:%i:%s', 'UTC');
+2022-08-13 07:58:32
+-- %c accepts single or double digits inputs
+select parseDateTime('8 13, 2022, 7:58:32', '%c %e, %G, %k:%i:%s', 'UTC');
+2022-08-13 07:58:32
+select parseDateTime('08 13, 2022, 07:58:32', '%c %e, %G, %k:%i:%s', 'UTC');
+2022-08-13 07:58:32
diff --git a/tests/queries/0_stateless/02668_parse_datetime.sql b/tests/queries/0_stateless/02668_parse_datetime.sql
index d8f2a94e188..02ac0c5f35c 100644
--- a/tests/queries/0_stateless/02668_parse_datetime.sql
+++ b/tests/queries/0_stateless/02668_parse_datetime.sql
@@ -168,4 +168,23 @@ select parseDateTime('12 AM', '%h %p', 'UTC', 'a fourth argument'); -- { serverE
-- Fuzzer crash bug #53715
select parseDateTime('', '', toString(number)) from numbers(13); -- { serverError ILLEGAL_COLUMN }
+-- %h
+select parseDateTime('Aug 13, 2022, 7:58:32 PM', '%b %e, %G, %h:%i:%s %p', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('Aug 13, 2022, 07:58:32 PM', '%b %e, %G, %h:%i:%s %p', 'UTC');
+-- %l accepts single or double digits inputs
+select parseDateTime('Aug 13, 2022, 7:58:32 PM', '%b %e, %G, %l:%i:%s %p', 'UTC');
+select parseDateTime('Aug 13, 2022, 07:58:32 PM', '%b %e, %G, %l:%i:%s %p', 'UTC');
+-- %H
+select parseDateTime('Aug 13, 2022, 7:58:32', '%b %e, %G, %H:%i:%s', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('Aug 13, 2022, 07:58:32', '%b %e, %G, %H:%i:%s', 'UTC');
+-- %k accepts single or double digits inputs
+select parseDateTime('Aug 13, 2022, 7:58:32', '%b %e, %G, %k:%i:%s', 'UTC');
+select parseDateTime('Aug 13, 2022, 07:58:32', '%b %e, %G, %k:%i:%s', 'UTC');
+-- %m
+select parseDateTime('8 13, 2022, 7:58:32', '%m %e, %G, %k:%i:%s', 'UTC'); -- { serverError CANNOT_PARSE_DATETIME }
+select parseDateTime('08 13, 2022, 07:58:32', '%m %e, %G, %k:%i:%s', 'UTC');
+-- %c accepts single or double digits inputs
+select parseDateTime('8 13, 2022, 7:58:32', '%c %e, %G, %k:%i:%s', 'UTC');
+select parseDateTime('08 13, 2022, 07:58:32', '%c %e, %G, %k:%i:%s', 'UTC');
+
-- { echoOff }
diff --git a/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.reference b/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.reference
deleted file mode 100644
index 025c04af1da..00000000000
--- a/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.reference
+++ /dev/null
@@ -1,124 +0,0 @@
--- { echoOn }
-SET optimize_move_functions_out_of_any = 1;
-EXPLAIN QUERY TREE SELECT any(number + number * 2) FROM numbers(1, 2);
-QUERY id: 0
- PROJECTION COLUMNS
- any(plus(number, multiply(number, 2))) UInt64
- PROJECTION
- LIST id: 1, nodes: 1
- FUNCTION id: 2, function_name: plus, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 3, nodes: 2
- FUNCTION id: 4, function_name: any, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 5, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- FUNCTION id: 8, function_name: multiply, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 9, nodes: 2
- FUNCTION id: 10, function_name: any, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 11, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- CONSTANT id: 12, constant_value: UInt64_2, constant_value_type: UInt8
- JOIN TREE
- TABLE_FUNCTION id: 7, table_function_name: numbers
- ARGUMENTS
- LIST id: 13, nodes: 2
- CONSTANT id: 14, constant_value: UInt64_1, constant_value_type: UInt8
- CONSTANT id: 15, constant_value: UInt64_2, constant_value_type: UInt8
-SELECT any(number + number * 2) FROM numbers(1, 2);
-3
-EXPLAIN QUERY TREE SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-QUERY id: 0
- PROJECTION COLUMNS
- anyLast(plus(number, multiply(number, 2))) UInt64
- PROJECTION
- LIST id: 1, nodes: 1
- FUNCTION id: 2, function_name: plus, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 3, nodes: 2
- FUNCTION id: 4, function_name: anyLast, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 5, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- FUNCTION id: 8, function_name: multiply, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 9, nodes: 2
- FUNCTION id: 10, function_name: anyLast, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 11, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- CONSTANT id: 12, constant_value: UInt64_2, constant_value_type: UInt8
- JOIN TREE
- TABLE_FUNCTION id: 7, table_function_name: numbers
- ARGUMENTS
- LIST id: 13, nodes: 2
- CONSTANT id: 14, constant_value: UInt64_1, constant_value_type: UInt8
- CONSTANT id: 15, constant_value: UInt64_2, constant_value_type: UInt8
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-6
-EXPLAIN QUERY TREE WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-QUERY id: 0
- PROJECTION COLUMNS
- x UInt64
- PROJECTION
- LIST id: 1, nodes: 1
- FUNCTION id: 2, function_name: multiply, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 3, nodes: 2
- FUNCTION id: 4, function_name: any, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 5, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- CONSTANT id: 8, constant_value: UInt64_3, constant_value_type: UInt8
- JOIN TREE
- TABLE_FUNCTION id: 7, table_function_name: numbers
- ARGUMENTS
- LIST id: 9, nodes: 2
- CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
- CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-3
-EXPLAIN QUERY TREE SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-QUERY id: 0
- PROJECTION COLUMNS
- x UInt64
- x UInt64
- PROJECTION
- LIST id: 1, nodes: 2
- FUNCTION id: 2, function_name: multiply, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 3, nodes: 2
- FUNCTION id: 4, function_name: anyLast, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 5, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- CONSTANT id: 8, constant_value: UInt64_3, constant_value_type: UInt8
- FUNCTION id: 2, function_name: multiply, function_type: ordinary, result_type: UInt64
- ARGUMENTS
- LIST id: 3, nodes: 2
- FUNCTION id: 4, function_name: anyLast, function_type: aggregate, result_type: UInt64
- ARGUMENTS
- LIST id: 5, nodes: 1
- COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
- CONSTANT id: 8, constant_value: UInt64_3, constant_value_type: UInt8
- JOIN TREE
- TABLE_FUNCTION id: 7, table_function_name: numbers
- ARGUMENTS
- LIST id: 9, nodes: 2
- CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
- CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-6 6
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
-SET optimize_move_functions_out_of_any = 0;
-SELECT any(number + number * 2) FROM numbers(1, 2);
-3
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-6
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-3
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-6 6
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
diff --git a/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.sql b/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.sql
deleted file mode 100644
index c9707d10fde..00000000000
--- a/tests/queries/0_stateless/02813_analyzer_push_any_to_functions.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-SET allow_experimental_analyzer = 1;
-
--- { echoOn }
-SET optimize_move_functions_out_of_any = 1;
-
-EXPLAIN QUERY TREE SELECT any(number + number * 2) FROM numbers(1, 2);
-SELECT any(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN QUERY TREE SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-
-EXPLAIN QUERY TREE WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-
-EXPLAIN QUERY TREE SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
-
-
-
-SET optimize_move_functions_out_of_any = 0;
-
-SELECT any(number + number * 2) FROM numbers(1, 2);
-
-SELECT anyLast(number + number * 2) FROM numbers(1, 2);
-
-WITH any(number * 3) AS x SELECT x FROM numbers(1, 2);
-
-SELECT anyLast(number * 3) AS x, x FROM numbers(1, 2);
-
-SELECT any(anyLast(number)) FROM numbers(1); -- { serverError 184 }
--- { echoOff }
diff --git a/tests/queries/0_stateless/02888_obsolete_settings.reference b/tests/queries/0_stateless/02888_obsolete_settings.reference
index 63553092c0c..378a5c7c389 100644
--- a/tests/queries/0_stateless/02888_obsolete_settings.reference
+++ b/tests/queries/0_stateless/02888_obsolete_settings.reference
@@ -40,6 +40,7 @@ multiple_joins_rewriter_version
odbc_max_field_size
optimize_duplicate_order_by_and_distinct
optimize_fuse_sum_count_avg
+optimize_move_functions_out_of_any
parallel_replicas_min_number_of_granules_to_enable
partial_merge_join_optimizations
query_cache_store_results_of_queries_with_nondeterministic_functions
diff --git a/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.reference b/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.reference
new file mode 100644
index 00000000000..61effdb19c4
--- /dev/null
+++ b/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.reference
@@ -0,0 +1,13 @@
+value
+value1 value2
+value1 value1 value2
+NOT-FOUND-KEY is not in HTTP request headers
+FORBIDDEN-KEY1 is in get_client_http_header_forbidden_headers
+1 row1_value1 row1_value2 row1_value3 row1_value4 row1_value5 row1_value6 row1_value7
+2 row2_value1 row2_value2 row2_value3 row2_value4 row2_value5 row2_value6 row2_value7
+3
+value_from_query_1 value_from_query_2 value_from_query_3 1 row1_value1 row1_value2 row1_value3 row1_value4 row1_value5 row1_value6 row1_value7
+value_from_query_1 value_from_query_2 value_from_query_3 2 row2_value1 row2_value2 row2_value3 row2_value4 row2_value5 row2_value6 row2_value7
+value_from_query_1 value_from_query_2 value_from_query_3 3
+http_value1
+http_value2
diff --git a/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.sh b/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.sh
new file mode 100755
index 00000000000..505e017ee5d
--- /dev/null
+++ b/tests/queries/0_stateless/02911_getHTTPHeaderFuncion.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+# shellcheck source=../shell_config.sh
+. "$CUR_DIR"/../shell_config.sh
+
+echo "SELECT getClientHTTPHeader('key')" | curl -s -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' -H 'key: value' 'http://localhost:8123/' -d @-
+
+echo "SELECT getClientHTTPHeader('key1'), getClientHTTPHeader('key2')" | curl -s -H 'X-Clickhouse-User: default' \
+ -H 'X-ClickHouse-Key: ' -H 'key1: value1' -H 'key2: value2' 'http://localhost:8123/' -d @-
+
+echo "SELECT getClientHTTPHeader('test-' || 'key' || '-1'), getClientHTTPHeader('test-key-1'), getClientHTTPHeader('key2')" | curl -s -H 'X-Clickhouse-User: default' \
+ -H 'X-ClickHouse-Key: ' -H 'test-key-1: value1' -H 'key2: value2' 'http://localhost:8123/' -d @-
+
+#Code: 36. DB::Exception: NOT-FOUND-KEY is not in HTTP request headers
+echo "SELECT getClientHTTPHeader('NOT-FOUND-KEY')"| curl -s -H 'X-Clickhouse-User: default' \
+ -H 'X-ClickHouse-Key: ' -H 'key1: value1' -H 'key2: value2' 'http://localhost:8123/' -d @- | grep -o -e "NOT-FOUND-KEY is not in HTTP request headers"
+
+#Code: 36. DB::Exception: The header FORBIDDEN-KEY is in headers_forbidden_to_return, you can config it in config file.
+echo "SELECT getClientHTTPHeader('FORBIDDEN-KEY1')" | curl -s -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' \
+ -H 'FORBIDDEN-KEY1: forbbiden1' 'http://localhost:8123/' -d @- | grep -o -e "FORBIDDEN-KEY1 is in get_client_http_header_forbidden_headers"
+
+db_name=${CLICKHOUSE_DATABASE}
+
+$CLICKHOUSE_CLIENT -q "CREATE DATABASE IF NOT EXISTS ${db_name};"
+
+$CLICKHOUSE_CLIENT -q "CREATE TABLE ${db_name}.02884_get_http_header
+ (id UInt32,
+ http_key1 String DEFAULT getClientHTTPHeader('http_header_key1'),
+ http_key2 String DEFAULT getClientHTTPHeader('http_header_key2'),
+ http_key3 String DEFAULT getClientHTTPHeader('http_header_key3'),
+ http_key4 String DEFAULT getClientHTTPHeader('http_header_key4'),
+ http_key5 String DEFAULT getClientHTTPHeader('http_header_key5'),
+ http_key6 String DEFAULT getClientHTTPHeader('http_header_key6'),
+ http_key7 String DEFAULT getClientHTTPHeader('http_header_key7')
+ )
+ Engine=MergeTree()
+ ORDER BY id"
+
+#Insert data via http request
+echo "INSERT INTO ${db_name}.02884_get_http_header (id) values (1)" | curl -s -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' \
+ -H 'http_header_key1: row1_value1'\
+ -H 'http_header_key2: row1_value2'\
+ -H 'http_header_key3: row1_value3'\
+ -H 'http_header_key4: row1_value4'\
+ -H 'http_header_key5: row1_value5'\
+ -H 'http_header_key6: row1_value6'\
+ -H 'http_header_key7: row1_value7' 'http://localhost:8123/' -d @-
+
+echo "INSERT INTO ${db_name}.02884_get_http_header (id) values (2)" | curl -s -H 'X-ClickHouse-User: default' -H 'X-ClickHouse-Key: ' \
+ -H 'http_header_key1: row2_value1'\
+ -H 'http_header_key2: row2_value2'\
+ -H 'http_header_key3: row2_value3'\
+ -H 'http_header_key4: row2_value4'\
+ -H 'http_header_key5: row2_value5'\
+ -H 'http_header_key6: row2_value6'\
+ -H 'http_header_key7: row2_value7' 'http://localhost:8123/' -d @-
+
+$CLICKHOUSE_CLIENT -q "SELECT id, http_key1, http_key2, http_key3, http_key4, http_key5, http_key6, http_key7 FROM ${db_name}.02884_get_http_header ORDER BY id;"
+#Insert data via tcp client
+$CLICKHOUSE_CLIENT --param_db="$db_name" -q "INSERT INTO ${db_name}.02884_get_http_header (id) values (3)"
+$CLICKHOUSE_CLIENT --param_db="$db_name" -q "SELECT * FROM ${db_name}.02884_get_http_header where id = 3"
+
+echo "SELECT getClientHTTPHeader('key_from_query_1'), getClientHTTPHeader('key_from_query_2'), getClientHTTPHeader('key_from_query_3'), * FROM ${db_name}.02884_get_http_header ORDER BY id" | curl -s -H 'X-Clickhouse-User: default' \
+ -H 'X-ClickHouse-Key: ' -H 'key_from_query_1: value_from_query_1' -H 'key_from_query_2: value_from_query_2' -H 'key_from_query_3: value_from_query_3' 'http://localhost:8123/' -d @-
+
+$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS ${db_name}.02884_get_http_header"
+
+$CLICKHOUSE_CLIENT -q "CREATE TABLE IF NOT EXISTS ${db_name}.02884_header_from_table (header_name String) Engine=Memory"
+$CLICKHOUSE_CLIENT -q "INSERT INTO ${db_name}.02884_header_from_table values ('http_key1'), ('http_key2')"
+
+echo "SELECT getClientHTTPHeader(header_name) as value from (select * FROM ${db_name}.02884_header_from_table) order by value" | curl -s -H 'X-Clickhouse-User: default' \
+ -H 'X-ClickHouse-Key: ' -H 'http_key1: http_value1' -H 'http_key2: http_value2' 'http://localhost:8123/' -d @-
+
+$CLICKHOUSE_CLIENT -q "DROP DATABASE ${db_name}"
diff --git a/tests/queries/0_stateless/02918_fuzzjson_table_function.reference b/tests/queries/0_stateless/02918_fuzzjson_table_function.reference
new file mode 100644
index 00000000000..1b5c6f46f77
--- /dev/null
+++ b/tests/queries/0_stateless/02918_fuzzjson_table_function.reference
@@ -0,0 +1,152 @@
+{"QJC4GhRByEtEAjku":{}}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{"Cicktxh":true, "SpByjZKtr2VAyHCO":false}
+{"ClickHouse":"Is Fast", "VO7TCIkyu1akvN":{}}
+{"ClickHouse":"Is Fast"}
+{"ISlW1DB":"Is Fast", "5j4ATkq":{}}
+{"ClickHouse":false}
+{"ClickHouse":"Is Fast", "tRSz":13522460516091116060}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast"}
+{"CzTcYkQdSce":"Is Fast"}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":false}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast", "jql0YAY":[]}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast", "lF2vXus":false}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast"}
+{"ClickHouse":"Is Fast"}
+{"QJiGcwkonghk":"Is Fast"}
+{"sidetx":[{"name":"Alice"}, {"R6Vm":false}, {}], "SpByjZKtr2VAyHCO":false}
+{"students":[{"name":"Alice"}, {"name":"Bob"}]}
+{"students":[{"name":"Alice"}, {"name":true}]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}]}
+{"ISuW1":[{"naYmS":"Alice", "hzTDYZQdScOct0RS":[]}, {"name":"Bob"}]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}], "jql0YAY":[]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}], "lF2vXus":false}
+{"students":[{"QJmGe":"Alice"}, {"name":"Bob"}]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}]}
+{"kXtdet":[{"name":"Alice"}, {"name":"Bob"}]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}], "Qcm4":{}}
+{"students":[{"name":"Alice"}, {"PmjG":"Bob"}]}
+{"students":[{"name":6128974479331836233}, {"name":"Bob"}]}
+{"sGudyet5u":[{"name":"Alice"}, {"name":"Bob"}, {}]}
+{"students":[{"name":"Alice"}, {"name":"Bob"}]}
+{"students":[{"Kamc":true}, {"name":"rKKN+5#NKEi-uf5U"}]}
+{"students":[{"name":"Alice"}, {"nPL6":1455900058404521160}]}
+{"students":[{"name":"Alice", "dzm5g9aPI21iIP9":[]}, {"name":"Bob"}]}
+{"students":[{"n4z4N":true, "uJrCh4ifo":{}}, {"name":"Bob", "kMnsl0BBFk":[]}], "kG21YiAcUKpcUS2":true}
+{"students":[{"name":"Alice"}, {"name":"Bob", "wQCN":{}}]}
+{"schedule":[{"breakfast":"7am", "5ZB35":{"nHypO":[]}}, {"lunch":"12pm"}]}
+{"schedule":[{"bdvelrflX":"7am", "5ZB35":{"nHypO":[]}}, {"23slh":"12pm"}]}
+{"tkdu8hl":[{"bdvelrflX":"7am", "5ZB35":{"nHypO":[]}}, {"23slh":"12pm"}]}
+{"tkdu8hl":[{"bdvelrflX":"7am", "5mkj5":{"nHypO":[]}}, {"23slh":"12pm"}], "n8HX5N6DVpBa":["fYOPSVVK*Brv_-AajZwT"]}
+{"tkdu8hl":[{"nQ4PePPfX":16091119822740071899, "5mkj5":{"npOE":[[]]}}, {"23slh":"12pm"}], "nHXa6BVq8E":["fYOPSVVK*Brv_-AajZwT"], "BHUNvB8sHk8ts6":true}
+{"tkdu8hl":[{"nQ4PePPfX":16091119822740071899, "5mkj5":{"G71D":[[], []]}}, {"23slh":"12pm"}], "FOIRaJ6VqVCKD0E":["fYOPSVVK*Brv_-AajZwT", 17244534201851710710], "BHUNvB8sHk8ts6":true, "qnk47QAn0yQ3ESEgO":true}
+{"tkdu8hl":[{"nQ4PePPfX":16091119822740071899, "5mkj5":{"G71D":[[], []]}}, {"23slh":"-plal2e"}], "FOIRaJ6VqVCKD0E":["fYOPSVVK*Brv_-AajZwT", 17244534201851710710], "BHUNvB8sHk8ts6":true, "qnk47QAn0yQ3ESEgO":true}
+{"tkdu8hl":[{"nQ4PePPfX":16091119822740071899, "5mkj5":{"Gpq7":[[], [false]]}, "YgbEtY":true}, {"23slh":false}], "FOIRaJ6VqVCKD0E":["fYOPSVVK*Brv_-AajZwT", 17244534201851710710], "ByRvBC4H0kgydJ":false, "zqokAQz8z0KnPOBrs8":true}
+{"kzcUZOl":[{"nQ4PePPfX":16091119822740071899, "Ekmj":{"lBKR":[[], [false], []], "dLc32r2f":{}}, "xbguW":"vGV&bitEteAH%-Eigg_7VlejYuHP"}, {"23slh":false}, {}], "FOIRaJ6VqVCKD0E":["fYOPSVVK*Brv_-AajZwT", 17244534201851710710], "ByRvBC4H0kgydJ":false, "zqokAQz8z0KnPOBrs8":true}
+{"kzcUZOl":[{"nQ4PePPfX":16091119822740071899, "Ekmj":{"lBKR":[[3774015142547830176], [false], []], "rCmVPvvf":{"wU6YWjag":[]}}, "xb7uW":"pWUTs&ikTCNRQt"}, {"23slh":false}, {}], "h3IK06PQGfCRQ":[false, false], "SyRRLBzEjy8YJ":false, "zqokAQz8z0KnPOBrs8":true}
+{"ukrzZl":[{"nQ4PePPfX":16091119822740071899, "5kmG":{"lBKR":[[14228925827882160318, "TpCrsW@11Io1sSu1@nFm"], [true], []], "rOmNvc":{"wU6YWjag":[], "pIK6tGXUp1gekWViJ":{}}, "igqgnb":[]}, "xb7uW":"pWUTs&ikTCNRQt", "jBT1ImcYb77bl2":true}, {"dsyf":true}, {}, {"qOElRhbehMXQNrln":{"PDoZa8OJHh1al59Ggq":{}}}], "h3IK06PQGfCRQ":[false, false], "SyRRLBzEjy8YJ":false, "zqokAQz8z0KnPOBrs8":true}
+{"ukrzZl":[{"nQ4PePPfX":16091119822740071899, "5kmG":{"lBKR":[[14228925827882160318, "TpCrsW@11Io1sSu1@nFm"], [true], []], "rOmNvc":{"wU6YWjag":[], "pIK6tGXUp1gekWViJ":{}}, "igqgnb":[]}, "xb7uW":"pWUTs&ikTCNRQt", "jBT1ImcYb77bl2":true}, {"dsyf":18233789955605096603}, {}, {"qOElRhbehMXQNrln":{"PoZngOHXMaWGRJq":{"QlnPi9zKoBtW2nGWB":"LgFazuGX*CuDy7X%4hkEmykg@6"}}}], "h3IK06PQGfCRQ":[false, false], "SyRRLBzEjy8YJ":false, "zQO8BA7nazqKW7CRP8":true}
+{"ukrzZl":[{"nQ4PePPfX":16091119822740071899, "5kmG":{"lBKR":[[16730631663303458403, "TpCrsW@11Io1sSu1@nFm"], [true], []], "rOmNvc":{"wU6YWjag":[false], "pIK6tGXUp1gekWViJ":{}}, "igqgnb":[]}, "xb7uW":"pWUTs&ikTCNRQt", "jBT1ImcYb77bl2":true}, {"dsyf":18233789955605096603, "mmCFLovnBThJPtpQG0Tv":false}, {}, {"qOElRhbehMXQNrln":{"PoZngOHXMaWGRJq":{"QlnPi9zKoBtW2nGWB":"LgFazuGX*CuDy7X%4hkEmykg@6"}}}, {"sx21nRmS69bXRo":[]}], "h3IK06PQGfCRQ":[false, "HjPw@G1Icu#dn"], "SyRRLBzEjy8YJ":false, "zQO8BA7nazqKW7CRP8":true}
+{"ukrzZl":[{"nQ4PePPfX":16091119822740071899, "5kmG":{"lBKR":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D"], [true], [], []], "rOmNvc":{"wOWxSWQf":[false], "pIK6tGXUp1gekWViJ":{}, "pFKIzg3HC":14538916875375166988}, "igqgnb":[]}, "xb7uW":"pWUTs&ikTCNRQt", "jlT1T35c27wbl2":true}, {"dsyf":18233789955605096603, "mYikENkiDhPRtQHOr":true}, {}, {"qOElRhbehMXQNrln":{"4GBqJBrnoOHJW5GA":{"QaPSqINbjb7nGx9qz":8975023301134451623, "JWOUP4WB1":14622543266409160782}}}, {"sx21nRmS69bXRo":[]}], "h3IK06PQGfCRQ":[false, "HjPw@G1Icu#dn"], "S1ncA0ERs8Y9v":"@7EShAFjSycp%Wo0gHn", "zQO8BA7nazqKW7CRP8":true}
+{"ukrzZl":[{"nQ4PePPfX":11197252787701758701, "5kmG":{"lBKR":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D", false], [true, true], [], []], "rOmNvc":{"wOWxSWQf":[false], "pIK6tGXUp1gekWViJ":{}, "pFKIzg3HC":14538916875375166988}, "igqgnb":[], "pUDeAJw":"MN^9hUPKv811Vq!"}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":18233789955605096603, "mYikENkiDhPRtQHOr":true}, {}, {"qOElRhbehMXQNrln":{"4GBqJBrnoOHJW5GA":{"QaPSqINbjb7nGx9qz":8975023301134451623, "aOUaQBB":false}}}, {"x27uem04bX6R87b":[[]]}, {"MqSQ5v":[]}], "h3IK06PQGfCRQ":[false, "7pq+IfdiKeTkTym7AWjlc"], "S1ncA0ERs8Y9v":"@7EShAFjSycp%Wo0gHn", "zQO8BA7nazqKW7CRP8":true}
+{"UkPbWZl":[{"nQ4PePPfX":11197252787701758701, "5kmG":{"lBKR":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D", false], [true, true], [false], []], "rvCMyf":{"2pnWUuQ6J":[false, "q-5Gl5B8uOK"], "pIK6tGXUp1gekWViJ":{}, "pFKIzg3HC":14538916875375166988, "yeNIt3JgSC0K":1931793149388080066}, "BVH5PAgEe4b":[], "pUDeAJw":"LnJMn0D&2lr^k!A", "uDl68z":516601863564431352}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":"F!*nU1V_WOni8$a9RXBHGob^sg", "mYikENkiDhPRtQHOr":true}, {}, {"qOURhbeBpKE8qrhC":{"4GBqJBrnoOHJW5GA":{"QaPSqINbjb7nGx9qz":8975023301134451623, "OUlR":false}}}, {"x27uem04bX6R87b":[[]]}, {"MqSQ5v":[]}], "h3IK06PQGfCRQ":[false, "7pq+IfdiKeTkTym7AWjlc", true], "dlCX4s8LF":"@7EShAFjSycp%Wo0gHn", "zQO8BA7nazqKW7CRP8":true, "XahaweEPjnHUyKsT":{}}
+{"IkkCdvbW8oLK":[{"nQ4PePPfX":11197252787701758701, "5kmG":{"lB3l":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D", 17822336972471685000], [true, true], [false], [], []], "rvCMyf":{"2pnWUuQ6J":[false, "q-5Gl5B8uOK"], "pIK6tGXUp1gekWViJ":{}, "pFKIzg3HC":14538916875375166988, "yeNIt3JgSC0K":1931793149388080066}, "BVH5PAgEe4b":[], "pUDeAJw":"LnJMn0D&2lr^k!A", "uDl68z":"fDT@hLdFJNXwBfJ__Fok7u2@BWY^t0"}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":false, "mYikENkiDhPRtQHOr":true}, {}, {"qOURhbeBpKE8qrhC":{"7Qf27pQMkchIOBWX":{"QaPSqINbjb7nGx9qz":8975023301134451623, "OUlR":false, "EoEJ7GlbhI0":[]}}}, {"x27uem04bX6R87b":[[[]], []]}, {"MqSQ5v":[9304041946960766827]}, {}], "h3IK06PQGfCRQ":[false, "7pq+IfdiKeTkTym7AWjlc", true], "dlCX4s8LF":true, "zQO8BA7nazqKW7CRP8":true, "fOa5rfhNLCiqjrnUrtZ6":{}}
+{"IkkCdvbW8oLK":[{"nQ4PePPfX":11197252787701758701, "mGJx":{"lB3l":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D", 17822336972471685000], [true, true], [10370853850869029207], [], ["VaTduwAFH0ahN5xeJU"]], "rvCMyf":{"2pnWUuQ6J":[false, "6J%Orinf%4"], "pIK6tGXUp1gekWViJ":{}, "pFKIzg3HC":14538916875375166988, "yeNIt3JgSC0K":1931793149388080066}, "BVH5PAgEe4b":[], "pUDeAJw":"LnJMn0D&2lr^k!A", "uDl68z":"fDT@hLdFJNXwBfJ__Fok7u2@BWY^t0"}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":false, "mYikENkiDhPRtQHOr":true}, {}, {"qOURhbeBpKE8qrhC":{"7Qf27pQMkchIOBWX":{"aKaShNyxj7Gx9qB":8975023301134451623, "OUlR":false, "EoEJ7GlbhI0":[]}}}, {"x27uem04bX6R87b":[[[]], []]}, {"MqSQ5v":[9304041946960766827, "T##LF8eDM"]}, {}], "h3IK06PQGfCRQ":[false, 6667769656296380039, true], "dlCX4s8LF":true, "zQO8BA7nazqKW7CRP8":true, "fOa5rfhNLCiqjrnUrtZ6":{}}
+{"IkkCdvbW8oLK":[{"nQ4PePPfX":11197252787701758701, "xGBZx":{"lB3l":[[16730631663303458403, "eiUmT%F$FQBWtWz^Tt7Ix&D", "sFwAP3"], [true, "-TBj_T1BS7OJh8^p1qO3!DK_X&CfwetZ"], [5795439407585677270, false], [], ["VaTduwAFH0ahN5xeJU"]], "OvMy":{"2pnWUuQ6J":[false, "6J%Orinf%4"], "wni3QGXfpgeq":{"QF0hiIqRIKp2mp04U":14287172497490584292}, "M8pg0INzhg3Hz":14538916875375166988, "yeNIt3JgSC0K":false, "TeFWw":[]}, "BVH5PAgEe4b":[], "pUDeAJw":"LnJMn0D&2lr^k!A", "uDl68z":"fDT@hLdFJNXwBfJ__Fok7u2@BWY^t0"}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":false, "mYikENkiDhPRtQHOr":true}, {}, {"DjYSOeUFNepEK4XvC":{"7Qf27pQMkchIOBWX":{"aKaShNyxj7Gx9qB":8975023301134451623, "OUlR":false, "EoEJ7GlbhI0":[]}}}, {"x27uem04bX6R87b":[[[15632688604980432085]], []]}, {"MqSQ5v":[9304041946960766827, "T##LF8eDM"]}, {}], "h3IK06PQGfCRQ":[false, 6667769656296380039, true], "dlCX4s8LF":true, "zQO8BA7nazqKW7CRP8":true, "fOa5rfhNLCiqjrnUrtZ6":{}}
+{"IkkCdvbW8oLK":[{"nQ4PePPfX":11197252787701758701, "xGBZx":{"lB3l":[["_#JSXSLdVKXb+c", "eiUmT%F$FQBWtWz^Tt7Ix&D", "sFwAP3"], [true, "-TBj_T1BS7OJh8^p1qO3!DK_X&CfwetZ"], [5795439407585677270, false], [], ["VaTduwAFH0ahN5xeJU"]], "OvMy":{"2pnWUuQ6J":[false, "6J%Orinf%4"], "wni3QGXfpgeq":{"QF0hiIqRIKp2mp04U":14287172497490584292}, "M8pg0INzhg3Hz":14538916875375166988, "yeNIt3JgSC0K":false, "TeFWw":[]}, "BVH5PAgEe4b":[], "pUDeAJw":"LnJMn0D&2lr^k!A", "uDl68z":"8&VE7"}, "oiU7x8":false, "jlT1T35c27wbl2":false}, {"dsyf":false, "mYikENkiDhPRtQHOr":true, "lbci":{}}, {}, {"DjYSOeUFNepEK4XvC":{"QVEsjfQBcsIEbRWBW":{"uGYvt33UTmxj7t2B":8975023301134451623, "OUlR":false, "EoEJ7GlbhI0":[]}, "Qya8i":{"EMfurslq2KFOCa29od0d":[]}}}, {"x27uem04bX6R87b":[[[15632688604980432085]], [[]]]}, {"MqSQ5v":[9304041946960766827, "T##LF8eDM"]}, {}], "sEdwKHDRafKvC":[false, 6667769656296380039, true], "dlCX4s8LF":true, "zQO8BA7nazqKW7CRP8":true, "fOa5rfhNLCiqjrnUrtZ6":{}}
+{"schedule":[{"breakfast":"7am", "5ZB35":{"nHypO":[]}}, {"lunch":"12pm"}]}
+{"schedule":[{"bdvelrflX":"7am"}, {"lunch":"12pm"}]}
+{"23sldMp":[{"Ob8hrGkHsU8X":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"bMnamkjsAsat":"7am"}, {"lunch":"12pm", "OfmJPaS":{}}]}
+{"snjTZul":[{"breakfast":"7am"}, {"lHkn6N":1318333088581732761}, {"bQH4jPs":{}}], "Hrv8ZL6":[]}
+{"schedule":[{"QrqaD":"!uUry9J-#VUCkKD0yyI+xM", "3e8EfNin":"0_Ny&1pcBzd8YEFq8hn4+Q#y^ESEg*"}, {"lunch":"12pm"}], "hGh8RR":{}}
+{"schedule":[{"regEsl2t":true, "q5flU9DI7erByRjh":{}}, {"lH0h":"%yJEbznodCJ8-#KzPNcBHrsr"}, {"pPk2zAcfUxDZcO":{}}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}, {}], "hZNsEeUmexM":{}}
+{"lhhG":[{"breakfast":"7am"}, {"lunch":"12pm", "OEgZYuhDWP3vGbV4bi":[]}, {}]}
+{"schedule":[{"breakfast":"kj*RPaKLng*&h4&UBqa-tw%53aE", "WtHnb8mVPvvHDUYWaJSB":[[]]}, {"lunch":"12pm"}], "6EigJgc8sxf7VIfMkDl":[]}
+{"schedule":[{"breakfast":false}, {"lunch":"12pm", "WikTL":1724418800345361559}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"h3hK0l":[{"breakfast":"7am", "fGNLfAC":{}}, {"lETzn6S":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"izEx":9011753325952200749}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"mY7la":17408441466865856756, "yIG0VqnoY1TTMjs":{"11BIo1csSuB1n":10038860187222625751}}]}
+{"cSJ8eOuN":[{"breakfast":"7am", "UgpWK":{"Wkha9tqdiOefZfAKQcEg":"EbhMQNrlngPo"}}, {"lunch":"12pm", "wGWGRJqJlPYzCB0":[]}, {}]}
+{"UBgFuue":[{"brrak2st":"kEmykg@6-%h-OQ@O_"}, {"lunch":"12pm", "7DnPaGPqi5Wr7":false}, {}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm", "LeH3":{}}]}
+{"schedule":[{"breakon":true}, {"Sx1Rch":9823913620251756169, "0TvaWJUmv0Cv":{}}]}
+{"schedule":[{"breakfast":"7am", "5ZB35":{"nHypO":[]}}, {"lunch":"12pm"}]}
+{"schedule":[{"bdvelrflX":"7am"}, {"lunch":"12pm"}]}
+{"23sldMp":[{"Ob8hrGkHsU8X":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"bMnamkjsAsat":"7am"}, {"lunch":"12pm", "OfmJPaS":{}}]}
+{"snjTZul":[{"breakfast":"7am"}, {"lHkn6N":1318333088581732761}, {"bQH4jPs":{}}], "Hrv8ZL6":[]}
+{"schedule":[{"QrqaD":"!uUry9J-#VUCkKD0yyI+xM", "3e8EfNin":"0_Ny&1pcBzd8YEFq8hn4+Q#y^ESEg*"}, {"lunch":"12pm"}], "hGh8RR":{}}
+{"schedule":[{"regEsl2t":true, "q5flU9DI7erByRjh":{}}, {"lH0h":"%yJEbznodCJ8-#KzPNcBHrsr"}, {"pPk2zAcfUxDZcO":{}}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}, {}], "hZNsEeUmexM":{}}
+{"lhhG":[{"breakfast":"7am"}, {"lunch":"12pm", "OEgZYuhDWP3vGbV4bi":[]}, {}]}
+{"schedule":[{"breakfast":"kj*RPaKLng*&h4&UBqa-tw%53aE", "WtHnb8mVPvvHDUYWaJSB":[[]]}, {"lunch":"12pm"}]}
+{"schedule":[{"breakfast":false}, {"lunch":"12pm", "WikTL":1724418800345361559}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"h3hK0l":[{"breakfast":"7am", "fGNLfAC":{}}, {"lETzn6S":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"izEx":9011753325952200749}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"mY7la":17408441466865856756, "yIG0VqnoY1TTMjs":{"11BIo1csSuB1n":10038860187222625751}}]}
+{"cSJ8eOuN":[{"breakfast":"7am", "UgpWK":{"Wkha9tqdiOefZfAKQcEg":"EbhMQNrlngPo"}}, {"lunch":"12pm", "wGWGRJqJlPYzCB0":[]}, {}]}
+{"UBgFuue":[{"brrak2st":"kEmykg@6-%h-OQ@O_"}, {"lunch":"12pm", "7DnPaGPqi5Wr7":false}, {}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm", "LeH3":{}}]}
+{"schedule":[{"breakon":true}, {"Sx1Rch":9823913620251756169, "0TvaWJUmv0Cv":{}}]}
+{"schedule":[{"breakfast":"7am", "5ZB35":{"nHypO":[]}}, {"lunch":"12pm"}]}
+{"schedule":[{"bdvelrflX":"7am"}, {"lunch":"12pm"}]}
+{"23sldMp":[{"Ob8hrGkHsU8X":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"bMnamkjsAsat":"7am"}, {"lunch":"12pm", "OfmJPaS":{}}]}
+{"snjTZul":[{"breakfast":"7am"}, {"lHkn6N":1318333088581732761}, {"bQH4jPs":{}}], "Hrv8ZL6":[]}
+{"schedule":[{"QrqaD":"!uUry9J-#VUCkKD0yyI+xM", "3e8EfNin":"0_Ny&1pcBzd8YEFq8hn4+Q#y^ESEg*"}, {"lunch":"12pm"}], "hGh8RR":{}}
+{"schedule":[{"regEsl2t":true, "q5flU9DI7erByRjh":{}}, {"lH0h":"%yJEbznodCJ8-#KzPNcBHrsr"}, {"pPk2zAcfUxDZcO":{}}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}, {}], "hZNsEeUmexM":{}}
+{"lhhG":[{"breakfast":"7am"}, {"lunch":"12pm", "OEgZYuhDWP3vGbV4bi":[]}, {}]}
+{"schedule":[{"breakfast":"kj*RPaKLng*&h4&UBqa-tw%53aE", "WtHnb8mVPvvHDUYWaJSB":[[]]}, {"lunch":"12pm"}], "6EigJgc8sxf7VIfMkDl":[]}
+{"schedule":[{"breakfast":false}, {"lunch":"12pm", "WikTL":1724418800345361559}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"h3hK0l":[{"breakfast":"7am", "fGNLfAC":{}}, {"lETzn6S":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"izEx":9011753325952200749}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}
+{"schedule":[{"breakfast":"7am"}, {"mY7la":17408441466865856756, "yIG0VqnoY1TTMjs":{"11BIo1csSuB1n":10038860187222625751}}]}
+{"cSJ8eOuN":[{"breakfast":"7am", "UgpWK":{"Wkha9tqdiOefZfAKQcEg":"EbhMQNrlngPo"}}, {"lunch":"12pm", "wGWGRJqJlPYzCB0":[]}, {}]}
+{"UBgFuue":[{"brrak2st":"kEmykg@6-%h-OQ@O_"}, {"lunch":"12pm", "7DnPaGPqi5Wr7":false}, {}]}
+{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm", "LeH3":{}}]}
+{"schedule":[{"breakon":true}, {"Sx1Rch":9823913620251756169, "0TvaWJUmv0Cv":{}}]}
+{}
+{}
+{}
+{"cuNC":"j#Q*KbvL"}
+{}
+{}
+{}
+{"e2mZBQPL9f0pgd0sXR":false}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+{}
+730
+200
diff --git a/tests/queries/0_stateless/02918_fuzzjson_table_function.sql b/tests/queries/0_stateless/02918_fuzzjson_table_function.sql
new file mode 100644
index 00000000000..6db0c69dbac
--- /dev/null
+++ b/tests/queries/0_stateless/02918_fuzzjson_table_function.sql
@@ -0,0 +1,106 @@
+-- Tags: no-parallel, no-replicated-database: Named collection is used
+
+SET allow_experimental_object_type = 1;
+--
+
+DROP NAMED COLLECTION IF EXISTS 02918_json_fuzzer;
+CREATE NAMED COLLECTION 02918_json_fuzzer AS json_str='{}';
+
+SELECT * FROM fuzzJSON(02918_json_fuzzer, random_seed=54321) LIMIT 10;
+SELECT * FROM fuzzJSON(02918_json_fuzzer, json_str='{"ClickHouse":"Is Fast"}', random_seed=1337) LIMIT 20;
+SELECT * FROM fuzzJSON(02918_json_fuzzer, json_str='{"students":[{"name":"Alice"}, {"name":"Bob"}]}', random_seed=1337) LIMIT 20;
+SELECT * FROM fuzzJSON(02918_json_fuzzer, json_str='{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}', random_seed=123456, reuse_output=true) LIMIT 20;
+SELECT * FROM fuzzJSON(02918_json_fuzzer, json_str='{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}', random_seed=123456, reuse_output=false) LIMIT 20;
+SELECT * FROM fuzzJSON(02918_json_fuzzer,
+ json_str='{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}',
+ random_seed=123456,
+ reuse_output=0,
+ max_output_length=128) LIMIT 20;
+
+SELECT * FROM fuzzJSON(02918_json_fuzzer,
+ json_str='{"schedule":[{"breakfast":"7am"}, {"lunch":"12pm"}]}',
+ random_seed=123456,
+ reuse_output=0,
+ max_output_length=65536,
+ max_nesting_level=10,
+ max_array_size=20) LIMIT 20;
+
+SELECT * FROM fuzzJSON(02918_json_fuzzer,
+ random_seed=6667,
+ max_nesting_level=0) LIMIT 10;
+
+SELECT * FROM fuzzJSON(02918_json_fuzzer,
+ random_seed=6667,
+ max_object_size=0,
+ max_array_size=0) LIMIT 10;
+
+--
+DROP TABLE IF EXISTS 02918_table_str;
+CREATE TABLE 02918_table_str (json_str String) Engine=Memory;
+
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(02918_json_fuzzer) limit 10;
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(02918_json_fuzzer) limit 10;
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(02918_json_fuzzer, random_seed=123, reuse_output=true) limit 10;
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(
+ 02918_json_fuzzer,
+ json_str='{"name": "John Doe", "age": 30, "address": {"city": "Citiville", "zip": "12345"}, "hobbies": ["reading", "traveling", "coding"]}',
+ random_seed=6666) LIMIT 200;
+
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(
+ 02918_json_fuzzer,
+ json_str='{"name": "John Doe", "age": 30, "address": {"city": "Citiville", "zip": "12345"}, "hobbies": ["reading", "traveling", "coding"]}',
+ random_seed=6666,
+ min_key_length=1,
+ max_key_length=5) LIMIT 200;
+
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(
+ 02918_json_fuzzer,
+ json_str='{"name": "John Doe", "age": 30, "address": {"city": "Citiville", "zip": "12345"}, "hobbies": ["reading", "traveling", "coding"]}',
+ max_nesting_level=128,
+ reuse_output=true,
+ random_seed=6666,
+ min_key_length=5,
+ max_key_length=5) LIMIT 200;
+
+INSERT INTO 02918_table_str SELECT * FROM fuzzJSON(
+ 02918_json_fuzzer,
+ json_str='{"name": "John Doe", "age": 30, "address": {"city": "Citiville", "zip": "12345"}, "hobbies": ["reading", "traveling", "coding"]}',
+ random_seed=6666,
+ reuse_output=1,
+ probability=0.5,
+ max_output_length=65536,
+ max_nesting_level=18446744073709551615,
+ max_array_size=18446744073709551615,
+ max_object_size=18446744073709551615,
+ max_key_length=65536,
+ max_string_value_length=65536) LIMIT 100;
+
+SELECT count() FROM 02918_table_str;
+
+DROP TABLE IF EXISTS 02918_table_str;
+
+--
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_output_length="Hello") LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_output_length=65537) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, probability=10) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, probability=-0.1) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, probability=1.1) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, probability=1.1) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_string_value_length=65537) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_key_length=65537) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_key_length=10, min_key_length=0) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+SELECT * FROM fuzzJSON(02918_json_fuzzer, max_key_length=10, min_key_length=11) LIMIT 10; -- { serverError BAD_ARGUMENTS }
+
+--
+DROP TABLE IF EXISTS 02918_table_obj;
+CREATE TABLE 02918_table_obj (json_obj Object('json')) Engine=Memory;
+
+INSERT INTO 02918_table_obj SELECT * FROM fuzzJSON(
+ 02918_json_fuzzer,
+ json_str='{"name": "John Doe", "age": 27, "address": {"city": "Citiville", "zip": "12345"}, "hobbies": ["reading", "traveling", "coding"]}',
+ random_seed=12345) LIMIT 200;
+SELECT count() FROM 02918_table_obj;
+
+DROP TABLE IF EXISTS 02918_table_obj;
+
+DROP NAMED COLLECTION IF EXISTS 02918_json_fuzzer;
diff --git a/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.reference b/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.reference
new file mode 100644
index 00000000000..a1ce6a27bb4
--- /dev/null
+++ b/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.reference
@@ -0,0 +1,3 @@
+0 0 false
+1 1 true
+0 0 false
diff --git a/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.sql b/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.sql
new file mode 100644
index 00000000000..f531ec0311d
--- /dev/null
+++ b/tests/queries/0_stateless/02919_segfault_nullable_materialized_update.sql
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS crash_02919;
+
+CREATE TABLE crash_02919 (
+ b Int64,
+ c Nullable(Int64) MATERIALIZED b,
+ d Nullable(Bool) MATERIALIZED b
+)
+ENGINE = MergeTree
+ORDER BY tuple();
+
+INSERT INTO crash_02919 VALUES (0);
+SELECT b, c, d FROM crash_02919;
+ALTER TABLE crash_02919 UPDATE b = 1 WHERE 1=1 SETTINGS mutations_sync = 1;
+SELECT b, c, d FROM crash_02919;
+ALTER TABLE crash_02919 UPDATE b = 0.1 WHERE 1=1 SETTINGS mutations_sync = 1;
+SELECT b, c, d FROM crash_02919;
+
+DROP TABLE crash_02919;
diff --git a/tests/queries/0_stateless/02919_storage_fuzzjson.reference b/tests/queries/0_stateless/02919_storage_fuzzjson.reference
new file mode 100644
index 00000000000..a134ce52c11
--- /dev/null
+++ b/tests/queries/0_stateless/02919_storage_fuzzjson.reference
@@ -0,0 +1,3 @@
+100
+100
+100
diff --git a/tests/queries/0_stateless/02919_storage_fuzzjson.sql b/tests/queries/0_stateless/02919_storage_fuzzjson.sql
new file mode 100644
index 00000000000..80b4a406a08
--- /dev/null
+++ b/tests/queries/0_stateless/02919_storage_fuzzjson.sql
@@ -0,0 +1,44 @@
+DROP TABLE IF EXISTS 02919_test_table_noarg;
+CREATE TABLE 02919_test_table_noarg(str String) ENGINE = FuzzJSON('{}');
+
+SELECT count() FROM (SELECT * FROM 02919_test_table_noarg LIMIT 100);
+
+DROP TABLE IF EXISTS 02919_test_table_noarg;
+
+--
+DROP TABLE IF EXISTS 02919_test_table_valid_args;
+CREATE TABLE 02919_test_table_valid_args(str String) ENGINE = FuzzJSON(
+ '{"pet":"rat"}', NULL);
+
+SELECT count() FROM (SELECT * FROM 02919_test_table_valid_args LIMIT 100);
+
+DROP TABLE IF EXISTS 02919_test_table_valid_args;
+
+--
+DROP TABLE IF EXISTS 02919_test_table_reuse_args;
+CREATE TABLE 02919_test_table_reuse_args(str String) ENGINE = FuzzJSON(
+ '{
+ "name": "Jane Doe",
+ "age": 30,
+ "city": "New York",
+ "contacts": {
+ "email": "jane@example.com",
+ "phone": "+1234567890"
+ },
+ "skills": [
+ "JavaScript",
+ "Python",
+ {
+ "frameworks": ["React", "Django"]
+ }
+ ],
+ "projects": [
+ {"name": "Project A", "status": "completed"},
+ {"name": "Project B", "status": "in-progress"}
+ ]
+ }',
+ 12345);
+
+SELECT count() FROM (SELECT * FROM 02919_test_table_reuse_args LIMIT 100);
+
+DROP TABLE IF EXISTS 02919_test_table_reuse_args;
diff --git a/tests/queries/0_stateless/format_schemas/02266_protobuf_format_google_wrappers.proto b/tests/queries/0_stateless/format_schemas/02266_protobuf_format_google_wrappers.proto
index e5283907936..7f72d599707 100644
--- a/tests/queries/0_stateless/format_schemas/02266_protobuf_format_google_wrappers.proto
+++ b/tests/queries/0_stateless/format_schemas/02266_protobuf_format_google_wrappers.proto
@@ -1,6 +1,6 @@
syntax = "proto3";
-import "wrappers.proto";
+import "google/protobuf/wrappers.proto";
message Message {
google.protobuf.StringValue str = 1;
diff --git a/tests/queries/0_stateless/format_schemas/wrappers.proto b/tests/queries/0_stateless/format_schemas/wrappers.proto
deleted file mode 100644
index c571f096879..00000000000
--- a/tests/queries/0_stateless/format_schemas/wrappers.proto
+++ /dev/null
@@ -1,123 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Wrappers for primitive (non-message) types. These types are useful
-// for embedding primitives in the `google.protobuf.Any` type and for places
-// where we need to distinguish between the absence of a primitive
-// typed field and its default value.
-//
-// These wrappers have no meaningful use within repeated fields as they lack
-// the ability to detect presence on individual elements.
-// These wrappers have no meaningful use within a map or a oneof since
-// individual entries of a map or fields of a oneof can already detect presence.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "google.golang.org/protobuf/types/known/wrapperspb";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "WrappersProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// Wrapper message for `double`.
-//
-// The JSON representation for `DoubleValue` is JSON number.
-message DoubleValue {
- // The double value.
- double value = 1;
-}
-
-// Wrapper message for `float`.
-//
-// The JSON representation for `FloatValue` is JSON number.
-message FloatValue {
- // The float value.
- float value = 1;
-}
-
-// Wrapper message for `int64`.
-//
-// The JSON representation for `Int64Value` is JSON string.
-message Int64Value {
- // The int64 value.
- int64 value = 1;
-}
-
-// Wrapper message for `uint64`.
-//
-// The JSON representation for `UInt64Value` is JSON string.
-message UInt64Value {
- // The uint64 value.
- uint64 value = 1;
-}
-
-// Wrapper message for `int32`.
-//
-// The JSON representation for `Int32Value` is JSON number.
-message Int32Value {
- // The int32 value.
- int32 value = 1;
-}
-
-// Wrapper message for `uint32`.
-//
-// The JSON representation for `UInt32Value` is JSON number.
-message UInt32Value {
- // The uint32 value.
- uint32 value = 1;
-}
-
-// Wrapper message for `bool`.
-//
-// The JSON representation for `BoolValue` is JSON `true` and `false`.
-message BoolValue {
- // The bool value.
- bool value = 1;
-}
-
-// Wrapper message for `string`.
-//
-// The JSON representation for `StringValue` is JSON string.
-message StringValue {
- // The string value.
- string value = 1;
-}
-
-// Wrapper message for `bytes`.
-//
-// The JSON representation for `BytesValue` is JSON string.
-message BytesValue {
- // The bytes value.
- bytes value = 1;
-}
\ No newline at end of file
diff --git a/utils/check-style/aspell-ignore/en/aspell-dict.txt b/utils/check-style/aspell-ignore/en/aspell-dict.txt
index 86f59e52482..3a74001e0d3 100644
--- a/utils/check-style/aspell-ignore/en/aspell-dict.txt
+++ b/utils/check-style/aspell-ignore/en/aspell-dict.txt
@@ -1,4 +1,4 @@
-personal_ws-1.1 en 2646
+personal_ws-1.1 en 2646
AArch
ACLs
ALTERs
@@ -1502,6 +1502,7 @@ formatRowNoNewline
formated
formatschema
formatter
+formatters
freezed
fromDaysSinceYearZero
fromModifiedJulianDay
@@ -1512,6 +1513,7 @@ fromUnixTimestampInJodaSyntax
fsync
func
fuzzBits
+fuzzJSON
fuzzer
fuzzers
gRPC
@@ -1533,6 +1535,7 @@ geohashEncode
geohashesInBox
geoip
geospatial
+getClientHTTPHeader
getMacro
getOSKernelVersion
getServerPort