mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
First draft
This commit is contained in:
parent
805171c41f
commit
483d415b24
@ -74,4 +74,25 @@ Received exception from server (version 1.1.54388):
|
||||
Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not.
|
||||
```
|
||||
|
||||
It is possible to use `size0` subcolumns that can be read without reading the whole column:
|
||||
|
||||
```sql
|
||||
CREATE TABLE t_arr (a Array(UInt32)) ENGINE = MergeTree ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO t_arr VALUES ([1]) ([]) ([1, 2, 3]) ([1, 2]);
|
||||
|
||||
SELECT a.size0 FROM t_arr;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─a.size0─┐
|
||||
│ 1 │
|
||||
│ 0 │
|
||||
│ 3 │
|
||||
│ 2 │
|
||||
└─────────┘
|
||||
```
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/data_types/array/) <!--hide-->
|
||||
|
@ -34,7 +34,7 @@ CREATE TABLE test.visits
|
||||
|
||||
This example declares the `Goals` nested data structure, which contains data about conversions (goals reached). Each row in the ‘visits’ table can correspond to zero or any number of conversions.
|
||||
|
||||
Only a single nesting level is supported. Columns of nested structures containing arrays are equivalent to multidimensional arrays, so they have limited support (there is no support for storing these columns in tables with the MergeTree engine).
|
||||
Arbitrary levels of nesting are supported. Columns of nested structures containing arrays are equivalent to multidimensional arrays, so they have limited support (there is no support for storing these columns in tables with the MergeTree engine).
|
||||
|
||||
In most cases, when working with a nested data structure, its columns are specified with column names separated by a dot. These columns make up an array of matching types. All the column arrays of a single nested data structure have the same length.
|
||||
|
||||
|
@ -41,4 +41,25 @@ SELECT x + y FROM t_null
|
||||
└────────────┘
|
||||
```
|
||||
|
||||
It is possible to use `null` subcolumns that can be read without reading the whole column:
|
||||
|
||||
``` sql
|
||||
CREATE TABLE nullable (`n` Nullable(UInt32)) ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO nullable VALUES (1) (NULL) (2) (NULL);
|
||||
|
||||
SELECT n.null FROM nullable;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─n.null─┐
|
||||
│ 0 │
|
||||
│ 1 │
|
||||
│ 0 │
|
||||
│ 1 │
|
||||
└────────┘
|
||||
```
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/data_types/nullable/) <!--hide-->
|
||||
|
@ -47,4 +47,30 @@ SELECT tuple(1, NULL) AS x, toTypeName(x)
|
||||
└──────────┴─────────────────────────────────┘
|
||||
```
|
||||
|
||||
It is possible to read elements of named tuples using indexes and names:
|
||||
|
||||
``` sql
|
||||
CREATE TABLE named_tuples (`a` Tuple(s String, i Int64)) ENGINE = Memory;
|
||||
|
||||
INSERT INTO named_tuples VALUES (('y', 10)), (('x',-10));
|
||||
|
||||
SELECT a.s FROM named_tuples;
|
||||
|
||||
SELECT a.2 FROM named_tuples;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─a.s─┐
|
||||
│ y │
|
||||
│ x │
|
||||
└─────┘
|
||||
|
||||
┌─tupleElement(a, 2)─┐
|
||||
│ 10 │
|
||||
│ -10 │
|
||||
└────────────────────┘
|
||||
```
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/data_types/tuple/) <!--hide-->
|
||||
|
Loading…
Reference in New Issue
Block a user