ClickHouse/tests/queries/0_stateless/01087_table_function_generate.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

200 lines
5.0 KiB
MySQL
Raw Normal View History

2020-02-11 14:05:51 +00:00
SELECT
toTypeName(ui64), toTypeName(i64),
toTypeName(ui32), toTypeName(i32),
toTypeName(ui16), toTypeName(i16),
toTypeName(ui8), toTypeName(i8)
2020-03-06 02:19:40 +00:00
FROM generateRandom('ui64 UInt64, i64 Int64, ui32 UInt32, i32 Int32, ui16 UInt16, i16 Int16, ui8 UInt8, i8 Int8')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-11 14:05:51 +00:00
SELECT
ui64, i64,
ui32, i32,
ui16, i16,
ui8, i8
2020-03-07 22:13:21 +00:00
FROM generateRandom('ui64 UInt64, i64 Int64, ui32 UInt32, i32 Int32, ui16 UInt16, i16 Int16, ui8 UInt8, i8 Int8', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-11 14:05:51 +00:00
SELECT '-';
2020-02-04 10:59:26 +00:00
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Enum8(\'hello\' = 1, \'world\' = 5)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Enum8(\'hello\' = 1, \'world\' = 5)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Array(Nullable(Enum8(\'hello\' = 1, \'world\' = 5)))')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Array(Nullable(Enum8(\'hello\' = 1, \'world\' = 5)))', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)s
2020-06-09 00:42:56 +00:00
FROM generateRandom('i Nullable(Enum16(\'h\' = 1, \'w\' = 5 , \'o\' = -200))')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-06-09 00:42:56 +00:00
FROM generateRandom('i Nullable(Enum16(\'h\' = 1, \'w\' = 5 , \'o\' = -200))', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
toTypeName(d), toTypeName(dt), toTypeName(dtm)
2022-05-27 00:18:38 +00:00
FROM generateRandom('d Date, dt DateTime(\'UTC\'), dtm DateTime(\'UTC\')')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-01 21:22:00 +00:00
SELECT
d, dt, dtm
2022-05-27 00:18:38 +00:00
FROM generateRandom('d Date, dt DateTime(\'UTC\'), dtm DateTime(\'UTC\')', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
toTypeName(dt64), toTypeName(dts64), toTypeName(dtms64)
2022-05-27 00:18:38 +00:00
FROM generateRandom('dt64 DateTime64(3, \'UTC\'), dts64 DateTime64(6, \'UTC\'), dtms64 DateTime64(6 ,\'UTC\')')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-01 21:22:00 +00:00
SELECT
dt64, dts64, dtms64
2022-05-27 00:18:38 +00:00
FROM generateRandom('dt64 DateTime64(3, \'UTC\'), dts64 DateTime64(6, \'UTC\'), dtms64 DateTime64(6 ,\'UTC\')', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
SELECT
toTypeName(d32)
FROM generateRandom('d32 Date32')
LIMIT 1;
SELECT
d32
FROM generateRandom('d32 Date32', 1, 10, 10)
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
toTypeName(f32), toTypeName(f64)
2020-03-06 02:19:40 +00:00
FROM generateRandom('f32 Float32, f64 Float64')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-01 21:22:00 +00:00
SELECT
f32, f64
2020-03-07 22:13:21 +00:00
FROM generateRandom('f32 Float32, f64 Float64', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(d32), toTypeName(d64), toTypeName(d64)
2020-03-06 02:19:40 +00:00
FROM generateRandom('d32 Decimal32(4), d64 Decimal64(8), d128 Decimal128(16)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
d32, d64, d128
2020-03-07 22:13:21 +00:00
FROM generateRandom('d32 Decimal32(4), d64 Decimal64(8), d128 Decimal128(16)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Tuple(Int32, Int64)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Tuple(Int32, Int64)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Array(Int8)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Array(Int8)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Array(Nullable(Int32))')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Array(Nullable(Int32))', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Tuple(Int32, Array(Int64))')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Tuple(Int32, Array(Int64))', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Nullable(String)', 1)
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Nullable(String)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
SELECT
2020-02-11 14:05:51 +00:00
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Array(String)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Array(String)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-11 14:05:51 +00:00
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
2020-02-11 14:05:51 +00:00
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i UUID')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
2020-02-11 14:05:51 +00:00
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i UUID', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
2020-02-11 14:05:51 +00:00
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i Array(Nullable(UUID))')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-04 10:59:26 +00:00
SELECT
2020-02-11 14:05:51 +00:00
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i Array(Nullable(UUID))', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
2020-02-01 21:22:00 +00:00
SELECT
2020-02-11 14:05:51 +00:00
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i FixedString(4)')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-01 21:22:00 +00:00
SELECT
2020-03-07 22:17:45 +00:00
hex(i)
2020-03-07 22:13:21 +00:00
FROM generateRandom('i FixedString(4)', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-11 14:05:51 +00:00
SELECT '-';
SELECT
toTypeName(i)
2020-03-06 02:19:40 +00:00
FROM generateRandom('i String')
2020-02-26 14:31:22 +00:00
LIMIT 1;
2020-02-11 14:05:51 +00:00
SELECT
i
2020-03-07 22:13:21 +00:00
FROM generateRandom('i String', 1, 10, 10)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
SELECT '-';
DROP TABLE IF EXISTS test_table;
2022-05-27 00:18:38 +00:00
CREATE TABLE test_table(a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3, 'UTC'), UUID)) ENGINE=Memory;
INSERT INTO test_table SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3, \'UTC\'), UUID)', 1, 10, 2)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
2020-03-08 01:24:13 +00:00
SELECT * FROM test_table ORDER BY a, d, c;
2020-02-04 10:59:26 +00:00
DROP TABLE IF EXISTS test_table;
SELECT '-';
DROP TABLE IF EXISTS test_table_2;
2022-05-27 00:18:38 +00:00
CREATE TABLE test_table_2(a Array(Int8), b UInt32, c Nullable(String), d Decimal32(4), e Nullable(Enum16('h' = 1, 'w' = 5 , 'o' = -200)), f Float64, g Tuple(Date, DateTime('UTC'), DateTime64(3, 'UTC'), UUID), h FixedString(2)) ENGINE=Memory;
INSERT INTO test_table_2 SELECT * FROM generateRandom('a Array(Int8), b UInt32, c Nullable(String), d Decimal32(4), e Nullable(Enum16(\'h\' = 1, \'w\' = 5 , \'o\' = -200)), f Float64, g Tuple(Date, DateTime(\'UTC\'), DateTime64(3, \'UTC\'), UUID), h FixedString(2)', 10, 5, 3)
2020-02-26 14:31:22 +00:00
LIMIT 10;
2020-02-04 10:59:26 +00:00
2020-03-08 01:24:13 +00:00
SELECT a, b, c, d, e, f, g, hex(h) FROM test_table_2 ORDER BY a, b, c, d, e, f, g, h;
2020-02-04 10:59:26 +00:00
SELECT '-';
DROP TABLE IF EXISTS test_table_2;
select * from generateRandom('x UInt64', Null, 10, 2) limit 2 format Null;