mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
43 lines
2.4 KiB
SQL
43 lines
2.4 KiB
SQL
SELECT 'Into String';
|
|
SELECT reinterpret(49, 'String');
|
|
SELECT 'Into FixedString';
|
|
SELECT reinterpret(49, 'FixedString(1)');
|
|
SELECT reinterpret(49, 'FixedString(2)');
|
|
SELECT reinterpret(49, 'FixedString(3)');
|
|
SELECT reinterpret(49, 'FixedString(4)');
|
|
SELECT reinterpretAsFixedString(49);
|
|
SELECT 'Into Numeric Representable';
|
|
SELECT 'Integer and Integer types';
|
|
SELECT reinterpret(257, 'UInt8'), reinterpretAsUInt8(257);
|
|
SELECT reinterpret(257, 'Int8'), reinterpretAsInt8(257);
|
|
SELECT reinterpret(257, 'UInt16'), reinterpretAsUInt16(257);
|
|
SELECT reinterpret(257, 'Int16'), reinterpretAsInt16(257);
|
|
SELECT reinterpret(257, 'UInt32'), reinterpretAsUInt32(257);
|
|
SELECT reinterpret(257, 'Int32'), reinterpretAsInt32(257);
|
|
SELECT reinterpret(257, 'UInt64'), reinterpretAsUInt64(257);
|
|
SELECT reinterpret(257, 'Int64'), reinterpretAsInt64(257);
|
|
SELECT reinterpret(257, 'Int128'), reinterpretAsInt128(257);
|
|
SELECT reinterpret(257, 'UInt256'), reinterpretAsUInt256(257);
|
|
SELECT reinterpret(257, 'Int256'), reinterpretAsInt256(257);
|
|
SELECT 'Integer and Float types';
|
|
SELECT reinterpret(toFloat32(0.2), 'UInt32'), reinterpretAsUInt32(toFloat32(0.2));
|
|
SELECT reinterpret(toFloat64(0.2), 'UInt64'), reinterpretAsUInt64(toFloat64(0.2));
|
|
SELECT reinterpretAsFloat32(a), reinterpretAsUInt32(toFloat32(0.2)) as a;
|
|
SELECT reinterpretAsFloat64(a), reinterpretAsUInt64(toFloat64(0.2)) as a;
|
|
SELECT 'Integer and String types';
|
|
SELECT reinterpret(a, 'String'), reinterpretAsString(a), reinterpretAsUInt8('1') as a;
|
|
SELECT reinterpret(a, 'String'), reinterpretAsString(a), reinterpretAsUInt8('11') as a;
|
|
SELECT reinterpret(a, 'String'), reinterpretAsString(a), reinterpretAsUInt16('11') as a;
|
|
SELECT 'Dates';
|
|
SELECT reinterpret(0, 'Date'), reinterpret('', 'Date');
|
|
SELECT reinterpret(0, 'DateTime(''Asia/Istanbul'')'), reinterpret('', 'DateTime(''Asia/Istanbul'')');
|
|
SELECT reinterpret(0, 'DateTime64(3, ''Asia/Istanbul'')'), reinterpret('', 'DateTime64(3, ''Asia/Istanbul'')');
|
|
SELECT 'Decimals';
|
|
SELECT reinterpret(toDecimal32(5, 2), 'Decimal32(2)'), reinterpret('1', 'Decimal32(2)');
|
|
SELECT reinterpret(toDecimal64(5, 2), 'Decimal64(2)'), reinterpret('1', 'Decimal64(2)');;
|
|
SELECT reinterpret(toDecimal128(5, 2), 'Decimal128(2)'), reinterpret('1', 'Decimal128(2)');
|
|
SELECT reinterpret(toDecimal256(5, 2), 'Decimal256(2)'), reinterpret('1', 'Decimal256(2)');
|
|
SELECT reinterpret(toDateTime64(0, 0), 'Decimal64(2)');
|
|
SELECT 'ReinterpretErrors';
|
|
SELECT reinterpret('123', 'FixedString(1)'); -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|