Skip to content

Commit f011c8d

Browse files
Merge branch 'master' into optimize-dictget-tuple-element
2 parents 4b43d1c + 1fc2b35 commit f011c8d

File tree

164 files changed

+5351
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+5351
-464
lines changed

ci/jobs/scripts/check_style/aspell-ignore/en/aspell-dict.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
personal_ws-1.1 en 3602
1+
personal_ws-1.1 en 3603
22
AArch
33
ABIs
44
ACLs
@@ -1529,6 +1529,7 @@ bcrypt's
15291529
bech
15301530
benchmarked
15311531
benchmarking
1532+
beeterty
15321533
bfloat
15331534
bigrams
15341535
binlog

ci/jobs/scripts/fuzzer/query-fuzzer-tweaks-users.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
</constraints>
4141

4242
<!-- Allow all experimental features by default -->
43-
<ast_fuzzer_runs>5</ast_fuzzer_runs>
44-
4543
<allow_create_index_without_type>1</allow_create_index_without_type>
4644
<allow_custom_error_code_in_throwif>1</allow_custom_error_code_in_throwif>
4745
<allow_ddl>1</allow_ddl>

contrib/replxx

contrib/rust_vendor

Submodule rust_vendor updated 3723 files

docs/en/interfaces/third-party/client-libraries.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ClickHouse Inc does **not** maintain the libraries listed below and hasn't done
3333
- [glushkovds/php-clickhouse-schema-builder](https://packagist.org/packages/glushkovds/php-clickhouse-schema-builder)
3434
- [kolya7k ClickHouse PHP extension](https://github.com//kolya7k/clickhouse-php)
3535
- [hyvor/clickhouse-php](https://github.com/hyvor/clickhouse-php)
36+
- [beeterty/clickhouse-php-client](https://github.com/beeterty-technologies/clickhouse-php-client)
3637
### Go {#go}
3738
- [clickhouse](https://github.com/kshvakov/clickhouse/)
3839
- [go-clickhouse](https://github.com/roistat/go-clickhouse)

docs/en/sql-reference/data-types/newjson.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,60 @@ SELECT json.^a.b, json.^d.e.f FROM test;
322322
```
323323

324324
:::note
325-
Reading sub-objects as sub-columns may be inefficient, as this may require a near full scan of the JSON data.
325+
When paths are stored in basic (`map`) [shared data](#shared-data-structure), reading sub-object sub-columns may be inefficient as it requires scanning the entire shared data structure. With `map_with_buckets` or `advanced` shared data serialization, reading sub-columns from shared data is highly optimized.
326+
:::
327+
328+
## Reading JSON combined sub-columns {#reading-json-combined-sub-columns}
329+
330+
The `JSON` type supports reading a path as a **combined sub-column** using the special syntax `[email protected]`.
331+
A combined sub-column for a given path returns:
332+
- The literal value stored at that path as `Dynamic`, if the path has a literal value.
333+
- A JSON sub-object at that path as `Dynamic`, if the path has no literal value but has nested sub-paths.
334+
- `NULL`, if neither a literal value nor any sub-paths exist for that path.
335+
336+
This is useful when a path may hold either a scalar value or a nested object across different rows, and is more convenient than separately querying the literal sub-column (`json.a`) and the sub-object sub-column (`json.^a`).
337+
338+
The following example compares all three sub-column types for path `a`:
339+
340+
```sql title="Query"
341+
CREATE TABLE test (json JSON) ENGINE = Memory;
342+
INSERT INTO test VALUES ('{"a" : 42, "b" : {"c" : 1, "d" : "Hello"}}'), ('{"a" : {"x": 1, "y": 2}, "b" : {"c" : 1}}'), ('{"c" : "World"}');
343+
SELECT json FROM test;
344+
```
345+
346+
```text title="Response"
347+
┌─json────────────────────────────┐
348+
│ {"a":42,"b":{"c":1,"d":"Hello"}}│
349+
│ {"a":{"x":1,"y":2},"b":{"c":1}}│
350+
│ {"c":"World"} │
351+
└─────────────────────────────────┘
352+
```
353+
354+
```sql title="Query"
355+
SELECT
356+
json.a,
357+
dynamicType(json.a),
358+
json.^a,
359+
toTypeName(json.^a),
360+
json.@a,
361+
dynamicType(json.@a)
362+
FROM test;
363+
```
364+
365+
```text title="Response"
366+
┌─json.a─┬─dynamicType(json.a)─┬─json.^a───────┬─toTypeName(json.^a)─┬─json.@a───────┬─dynamicType(json.@a)─┐
367+
│ 42 │ Int64 │ {} │ JSON │ 42 │ Int64 │
368+
│ NULL │ None │ {"x":1,"y":2} │ JSON │ {"x":1,"y":2} │ JSON │
369+
│ NULL │ None │ {} │ JSON │ NULL │ None │
370+
└────────┴─────────────────────┴───────────────┴─────────────────────┴───────────────┴──────────────────────┘
371+
```
372+
373+
- Row 1: `a` holds a literal `42`. `json.a` returns it as `Dynamic(Int64)`, `json.^a` returns an empty sub-object `{}` (no nested keys under `a`), and `json.@a` returns the literal `42`.
374+
- Row 2: `a` holds a nested object. `json.a` returns `NULL` (no literal at that path), `json.^a` returns the sub-object as `JSON`, and `json.@a` also returns the sub-object as `Dynamic(JSON)`.
375+
- Row 3: `a` is absent entirely. Both `json.a` and `json.@a` return `NULL`, while `json.^a` returns an empty `{}`.
376+
377+
:::note
378+
When paths are stored in basic (`map`) [shared data](#shared-data-structure), reading combined sub-columns may be inefficient as it requires scanning the entire shared data structure. With `map_with_buckets` or `advanced` shared data serialization, reading sub-columns from shared data is highly optimized.
326379
:::
327380

328381
## Type inference for paths {#type-inference-for-paths}

programs/client/Client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void Client::connect()
546546

547547
if (max_client_network_bandwidth)
548548
{
549-
ThrottlerPtr throttler = std::make_shared<Throttler>("client_network", max_client_network_bandwidth, 0, "");
549+
ThrottlerPtr throttler = std::make_shared<Throttler>(max_client_network_bandwidth, 0, "");
550550
connection->setThrottler(throttler);
551551
}
552552

rust/workspace/Cargo.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AggregateFunctions/SingleValueData.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#if USE_EMBEDDED_COMPILER
1010
# include <DataTypes/Native.h>
1111
# include <llvm/IR/IRBuilder.h>
12+
# include <base/extended_types.h>
1213
#endif
1314

1415
#include <cstring>
@@ -811,7 +812,9 @@ void SingleValueDataFixed<T>::compileMinMax(llvm::IRBuilderBase & builder, llvm:
811812
auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent());
812813
auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent());
813814

814-
constexpr auto is_signed = std::numeric_limits<T>::is_signed;
815+
/// Use ClickHouse's is_signed_v which, unlike std::numeric_limits<T>::is_signed, is specialized
816+
/// for Decimal and wide integer types.
817+
constexpr bool is_signed = is_signed_v<T>;
815818

816819
llvm::Value * should_change_after_comparison = nullptr;
817820

@@ -858,7 +861,7 @@ void SingleValueDataFixed<T>::compileMinMaxMerge(
858861
auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent());
859862
auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent());
860863

861-
constexpr auto is_signed = std::numeric_limits<T>::is_signed;
864+
constexpr bool is_signed = is_signed_v<T>;
862865

863866
llvm::Value * should_change_after_comparison = nullptr;
864867

0 commit comments

Comments
 (0)