mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
fix fuzzer failure in tupleElement formatting
This commit is contained in:
parent
1b2ed51ff5
commit
46e4134deb
@ -324,10 +324,14 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
|
||||
|
||||
if (!written && 0 == strcmp(name.c_str(), "tupleElement"))
|
||||
{
|
||||
/// It can be printed in a form of 'x.1' only if right hand side is unsigned integer literal.
|
||||
// It can be printed in a form of 'x.1' only if right hand side
|
||||
// is an unsigned integer lineral. We also allow nonnegative
|
||||
// signed integer literals, because the fuzzer sometimes inserts
|
||||
// them, and we want to have consistent formatting.
|
||||
if (const auto * lit = arguments->children[1]->as<ASTLiteral>())
|
||||
{
|
||||
if (lit->value.getType() == Field::Types::UInt64)
|
||||
if (isInt64FieldType(lit->value.getType())
|
||||
&& lit->value.get<Int64>() >= 0)
|
||||
{
|
||||
if (frame.need_parens)
|
||||
settings.ostr << '(';
|
||||
|
Loading…
Reference in New Issue
Block a user