mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Don't output number tips for date types
This commit is contained in:
parent
fb099bbd62
commit
37ffab494a
@ -16,6 +16,7 @@ PrettyBlockOutputFormat::PrettyBlockOutputFormat(
|
||||
WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings_, bool mono_block_, bool color_)
|
||||
: IOutputFormat(header_, out_), format_settings(format_settings_), serializations(header_.getSerializations()), color(color_), mono_block(mono_block_)
|
||||
{
|
||||
readable_number_tip = header_.getColumns().size() == 1 && WhichDataType(header_.getDataTypes()[0]->getTypeId()).isNumber();
|
||||
}
|
||||
|
||||
|
||||
@ -415,7 +416,7 @@ void PrettyBlockOutputFormat::writeSuffix()
|
||||
void PrettyBlockOutputFormat::writeReadableNumberTip(const Chunk & chunk)
|
||||
{
|
||||
auto columns = chunk.getColumns();
|
||||
auto is_single_number = chunk.getNumRows() == 1 && chunk.getNumColumns() == 1 && WhichDataType(columns[0]->getDataType()).isNumber();
|
||||
auto is_single_number = readable_number_tip && chunk.getNumRows() == 1 && chunk.getNumColumns() == 1;
|
||||
if (!is_single_number)
|
||||
return;
|
||||
auto value = columns[0]->getFloat64(0);
|
||||
|
@ -58,6 +58,7 @@ protected:
|
||||
bool color;
|
||||
|
||||
private:
|
||||
bool readable_number_tip = false;
|
||||
bool mono_block;
|
||||
/// For mono_block == true only
|
||||
Chunk mono_chunk;
|
||||
|
@ -278,3 +278,83 @@
|
||||
|
||||
1000000000
|
||||
1000000000
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date32') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└──────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date32') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└──────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date32') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└──────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29', 'Date32') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 │
|
||||
└──────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29 00:00:00', 'DateTime') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00 │
|
||||
└─────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29 00:00:00', 'DateTime') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00 │
|
||||
└─────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29 00:00:00', 'DateTime') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00 │
|
||||
└─────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST('2024-02-29 00:00:00', 'DateTime') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00 │
|
||||
└─────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST(CAST('2024-02-29 00:00:00', 'DateTime'), 'DateTime64') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00.000 │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST(CAST('2024-02-29 00:00:00', 'DateTime'), 'DateTime64') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00.000 │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST(CAST('2024-02-29 00:00:00', 'DateTime'), 'DateTime64') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00.000 │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ CAST(CAST('2024-02-29 00:00:00', 'DateTime'), 'DateTime64') ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 2024-02-29 00:00:00.000 │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
|
@ -77,3 +77,20 @@ SELECT 1_000_000_000 as a FROM system.numbers LIMIT 2 FORMAT PrettySpaceNoEscape
|
||||
SELECT 1_000_000_000 as a FROM system.numbers LIMIT 2 FORMAT PrettySpaceMonoBlock;
|
||||
SELECT 1_000_000_000 as a FROM system.numbers LIMIT 2 FORMAT PrettySpaceNoEscapesMonoBlock;
|
||||
|
||||
SET output_format_pretty_single_large_number_tip_threshold=1;
|
||||
SELECT '2024-02-29'::Date FORMAT Pretty;
|
||||
SELECT '2024-02-29'::Date FORMAT PrettyNoEscapes;
|
||||
SELECT '2024-02-29'::Date FORMAT PrettyMonoBlock;
|
||||
SELECT '2024-02-29'::Date FORMAT PrettyNoEscapesMonoBlock;
|
||||
SELECT '2024-02-29'::Date32 FORMAT Pretty;
|
||||
SELECT '2024-02-29'::Date32 FORMAT PrettyNoEscapes;
|
||||
SELECT '2024-02-29'::Date32 FORMAT PrettyMonoBlock;
|
||||
SELECT '2024-02-29'::Date32 FORMAT PrettyNoEscapesMonoBlock;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime FORMAT Pretty;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime FORMAT PrettyNoEscapes;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime FORMAT PrettyMonoBlock;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime FORMAT PrettyNoEscapesMonoBlock;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime::DateTime64 FORMAT Pretty;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime::DateTime64 FORMAT PrettyNoEscapes;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime::DateTime64 FORMAT PrettyMonoBlock;
|
||||
SELECT '2024-02-29 00:00:00'::DateTime::DateTime64 FORMAT PrettyNoEscapesMonoBlock;
|
||||
|
Loading…
Reference in New Issue
Block a user