mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
switch text to response for query blocks
This commit is contained in:
parent
8d099a4417
commit
d34a755cfb
@ -15,7 +15,7 @@ slug: /zh/operations/system-tables/numbers
|
||||
SELECT * FROM system.numbers LIMIT 10;
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─number─┐
|
||||
│ 0 │
|
||||
│ 1 │
|
||||
|
@ -15,7 +15,7 @@ slug: /zh/operations/system-tables/one
|
||||
SELECT * FROM system.one LIMIT 10;
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─dummy─┐
|
||||
│ 0 │
|
||||
└───────┘
|
||||
|
@ -23,7 +23,7 @@ slug: /zh/sql-reference/data-types/array
|
||||
SELECT array(1, 2) AS x, toTypeName(x)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─────┬─toTypeName(array(1, 2))─┐
|
||||
│ [1,2] │ Array(UInt8) │
|
||||
└───────┴─────────────────────────┘
|
||||
@ -33,7 +33,7 @@ SELECT array(1, 2) AS x, toTypeName(x)
|
||||
SELECT [1, 2] AS x, toTypeName(x)
|
||||
```
|
||||
|
||||
``` text
|
||||
```response
|
||||
┌─x─────┬─toTypeName([1, 2])─┐
|
||||
│ [1,2] │ Array(UInt8) │
|
||||
└───────┴────────────────────┘
|
||||
@ -50,7 +50,7 @@ ClickHouse会自动检测数组元素,并根据元素计算出存储这些元素
|
||||
SELECT array(1, 2, NULL) AS x, toTypeName(x)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐
|
||||
│ [1,2,NULL] │ Array(Nullable(UInt8)) │
|
||||
└────────────┴───────────────────────────────┘
|
||||
@ -62,7 +62,7 @@ SELECT array(1, 2, NULL) AS x, toTypeName(x)
|
||||
SELECT array(1, 'a')
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
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.
|
||||
```
|
||||
|
@ -24,7 +24,7 @@ slug: /zh/sql-reference/data-types/enum
|
||||
INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello')
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
Ok.
|
||||
|
||||
3 rows in set. Elapsed: 0.002 sec.
|
||||
@ -34,7 +34,7 @@ Ok.
|
||||
INSERT INTO t_enum VALUES('a')
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
Exception on client:
|
||||
Code: 49. DB::Exception: Unknown element 'a' for type Enum8('hello' = 1, 'world' = 2)
|
||||
```
|
||||
@ -45,7 +45,7 @@ Code: 49. DB::Exception: Unknown element 'a' for type Enum8('hello' = 1, 'world'
|
||||
SELECT * FROM t_enum
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─────┐
|
||||
│ hello │
|
||||
│ world │
|
||||
@ -59,7 +59,7 @@ SELECT * FROM t_enum
|
||||
SELECT CAST(x, 'Int8') FROM t_enum
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─CAST(x, 'Int8')─┐
|
||||
│ 1 │
|
||||
│ 2 │
|
||||
@ -73,7 +73,7 @@ SELECT CAST(x, 'Int8') FROM t_enum
|
||||
SELECT toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)'))
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)'))─┐
|
||||
│ Enum8('a' = 1, 'b' = 2) │
|
||||
└──────────────────────────────────────────────────────┘
|
||||
|
@ -13,7 +13,7 @@ slug: /zh/sql-reference/data-types/special-data-types/nothing
|
||||
SELECT toTypeName(array())
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─toTypeName(array())─┐
|
||||
│ Array(Nothing) │
|
||||
└─────────────────────┘
|
||||
|
@ -21,7 +21,7 @@ slug: /zh/sql-reference/data-types/tuple
|
||||
SELECT tuple(1,'a') AS x, toTypeName(x)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x───────┬─toTypeName(tuple(1, 'a'))─┐
|
||||
│ (1,'a') │ Tuple(UInt8, String) │
|
||||
└─────────┴───────────────────────────┘
|
||||
@ -37,7 +37,7 @@ SELECT tuple(1,'a') AS x, toTypeName(x)
|
||||
SELECT tuple(1, NULL) AS x, toTypeName(x)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x────────┬─toTypeName(tuple(1, NULL))──────┐
|
||||
│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │
|
||||
└──────────┴─────────────────────────────────┘
|
||||
|
@ -22,7 +22,7 @@ slug: /zh/sql-reference/functions/functions-for-nulls
|
||||
|
||||
存在以下内容的表
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─┬────y─┐
|
||||
│ 1 │ ᴺᵁᴸᴸ │
|
||||
│ 2 │ 3 │
|
||||
@ -35,7 +35,7 @@ slug: /zh/sql-reference/functions/functions-for-nulls
|
||||
SELECT x FROM t_null WHERE isNull(y)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─┐
|
||||
│ 1 │
|
||||
└───┘
|
||||
@ -60,7 +60,7 @@ SELECT x FROM t_null WHERE isNull(y)
|
||||
|
||||
存在以下内容的表
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─┬────y─┐
|
||||
│ 1 │ ᴺᵁᴸᴸ │
|
||||
│ 2 │ 3 │
|
||||
@ -73,7 +73,7 @@ SELECT x FROM t_null WHERE isNull(y)
|
||||
SELECT x FROM t_null WHERE isNotNull(y)
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─x─┐
|
||||
│ 2 │
|
||||
└───┘
|
||||
@ -98,7 +98,7 @@ SELECT x FROM t_null WHERE isNotNull(y)
|
||||
|
||||
考虑可以指定多种联系客户的方式的联系人列表。
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─name─────┬─mail─┬─phone─────┬──icq─┐
|
||||
│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │
|
||||
│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │
|
||||
@ -113,7 +113,7 @@ SELECT x FROM t_null WHERE isNotNull(y)
|
||||
SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐
|
||||
│ client 1 │ 123-45-67 │
|
||||
│ client 2 │ ᴺᵁᴸᴸ │
|
||||
|
@ -33,7 +33,7 @@ slug: /zh/sql-reference/functions/other-functions
|
||||
SELECT 'some/long/path/to/file' AS a, basename(a)
|
||||
```
|
||||
|
||||
``` text
|
||||
```response
|
||||
┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐
|
||||
│ some\long\path\to\file │ file │
|
||||
└────────────────────────┴────────────────────────────────────────┘
|
||||
@ -43,7 +43,7 @@ SELECT 'some/long/path/to/file' AS a, basename(a)
|
||||
SELECT 'some\\long\\path\\to\\file' AS a, basename(a)
|
||||
```
|
||||
|
||||
``` text
|
||||
```response
|
||||
┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐
|
||||
│ some\long\path\to\file │ file │
|
||||
└────────────────────────┴────────────────────────────────────────┘
|
||||
@ -53,7 +53,7 @@ SELECT 'some\\long\\path\\to\\file' AS a, basename(a)
|
||||
SELECT 'some-file-name' AS a, basename(a)
|
||||
```
|
||||
|
||||
``` text
|
||||
```response
|
||||
┌─a──────────────┬─basename('some-file-name')─┐
|
||||
│ some-file-name │ some-file-name │
|
||||
└────────────────┴────────────────────────────┘
|
||||
@ -402,7 +402,7 @@ FROM
|
||||
SELECT toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐
|
||||
│ DateTime │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
@ -412,7 +412,7 @@ SELECT toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))
|
||||
SELECT toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐
|
||||
│ Const(UInt32) │
|
||||
└───────────────────────────────────────────────────────────┘
|
||||
@ -466,7 +466,7 @@ SELECT toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))
|
||||
SELECT defaultValueOfArgumentType(CAST(1, 'Int8'))
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐
|
||||
│ 0 │
|
||||
└─────────────────────────────────────────────┘
|
||||
@ -476,7 +476,7 @@ SELECT defaultValueOfArgumentType(CAST(1, 'Int8'))
|
||||
SELECT defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐
|
||||
│ ᴺᵁᴸᴸ │
|
||||
└───────────────────────────────────────────────────────┘
|
||||
@ -497,7 +497,8 @@ SELECT defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))
|
||||
|
||||
```
|
||||
SELECT count() FROM ontime
|
||||
|
||||
```
|
||||
```response
|
||||
┌─count()─┐
|
||||
│ 4276457 │
|
||||
└─────────┘
|
||||
@ -511,7 +512,7 @@ SELECT count() FROM ontime
|
||||
SELECT FlightDate AS k, count() FROM ontime GROUP BY k ORDER BY k
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
SELECT
|
||||
FlightDate AS k,
|
||||
count()
|
||||
@ -537,7 +538,7 @@ ORDER BY k ASC
|
||||
SELECT FlightDate AS k, count() FROM ontime WHERE k = '2017-09-15' GROUP BY k ORDER BY k
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
SELECT
|
||||
FlightDate AS k,
|
||||
count()
|
||||
@ -561,7 +562,7 @@ ORDER BY k ASC
|
||||
SELECT FlightDate AS k, count() FROM ontime WHERE indexHint(k = '2017-09-15') GROUP BY k ORDER BY k
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
SELECT
|
||||
FlightDate AS k,
|
||||
count()
|
||||
|
@ -27,7 +27,7 @@ INSERT INTO t_uuid SELECT generateUUIDv4()
|
||||
SELECT * FROM t_uuid
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌────────────────────────────────────x─┐
|
||||
│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │
|
||||
└──────────────────────────────────────┘
|
||||
@ -51,7 +51,7 @@ UUID类型的值
|
||||
SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─────────────────────────────────uuid─┐
|
||||
│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │
|
||||
└──────────────────────────────────────┘
|
||||
@ -77,7 +77,7 @@ SELECT
|
||||
UUIDStringToNum(uuid) AS bytes
|
||||
```
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─uuid─────────────────────────────────┬─bytes────────────┐
|
||||
│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │
|
||||
└──────────────────────────────────────┴──────────────────┘
|
||||
@ -101,7 +101,8 @@ UUIDNumToString(FixedString(16))
|
||||
SELECT
|
||||
'a/<@];!~p{jTj={)' AS bytes,
|
||||
UUIDNumToString(toFixedString(bytes, 16)) AS uuid
|
||||
|
||||
```
|
||||
```response
|
||||
┌─bytes────────────┬─uuid─────────────────────────────────┐
|
||||
│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │
|
||||
└──────────────────┴──────────────────────────────────────┘
|
||||
|
@ -143,7 +143,7 @@ SELECT
|
||||
FROM test.Orders;
|
||||
```
|
||||
|
||||
``` text
|
||||
``` response
|
||||
┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐
|
||||
│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │
|
||||
└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘
|
||||
@ -161,7 +161,7 @@ FROM test.Orders;
|
||||
SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR
|
||||
```
|
||||
|
||||
``` text
|
||||
``` response
|
||||
┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐
|
||||
│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │
|
||||
└─────────────────────┴────────────────────────────────────────────────────────┘
|
||||
@ -230,7 +230,7 @@ ClickHouse 支持 `IS NULL` 和 `IS NOT NULL` 。
|
||||
SELECT x+100 FROM t_null WHERE y IS NULL
|
||||
```
|
||||
|
||||
``` text
|
||||
``` response
|
||||
┌─plus(x, 100)─┐
|
||||
│ 101 │
|
||||
└──────────────┘
|
||||
@ -249,7 +249,7 @@ SELECT x+100 FROM t_null WHERE y IS NULL
|
||||
SELECT * FROM t_null WHERE y IS NOT NULL
|
||||
```
|
||||
|
||||
``` text
|
||||
``` response
|
||||
┌─x─┬─y─┐
|
||||
│ 2 │ 3 │
|
||||
└───┴───┘
|
||||
|
@ -38,7 +38,7 @@ $$)
|
||||
|
||||
**Result:**
|
||||
|
||||
```text
|
||||
```response
|
||||
┌───b─┬─a─────┐
|
||||
│ 111 │ Hello │
|
||||
│ 123 │ World │
|
||||
@ -60,7 +60,7 @@ $$)
|
||||
|
||||
**Result:**
|
||||
|
||||
```text
|
||||
```response
|
||||
┌─name─┬─type──────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
|
||||
│ b │ Nullable(Float64) │ │ │ │ │ │
|
||||
│ a │ Nullable(String) │ │ │ │ │ │
|
||||
|
Loading…
Reference in New Issue
Block a user