From b590926c1ca9503cfcc92deccb9b1aa1f2839d5f Mon Sep 17 00:00:00 2001 From: fuqi Date: Sun, 4 Apr 2021 17:23:47 +0800 Subject: [PATCH 1/3] fix dist map type select --- src/Parsers/ASTFunction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parsers/ASTFunction.cpp b/src/Parsers/ASTFunction.cpp index 3cb2e8bfa37..c5f2a3034cd 100644 --- a/src/Parsers/ASTFunction.cpp +++ b/src/Parsers/ASTFunction.cpp @@ -483,14 +483,14 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format if (!written && 0 == strcmp(name.c_str(), "map")) { - settings.ostr << (settings.hilite ? hilite_operator : "") << '{' << (settings.hilite ? hilite_none : ""); + settings.ostr << (settings.hilite ? hilite_operator : "") << 'map(' << (settings.hilite ? hilite_none : ""); for (size_t i = 0; i < arguments->children.size(); ++i) { if (i != 0) settings.ostr << ", "; arguments->children[i]->formatImpl(settings, state, nested_dont_need_parens); } - settings.ostr << (settings.hilite ? hilite_operator : "") << '}' << (settings.hilite ? hilite_none : ""); + settings.ostr << (settings.hilite ? hilite_operator : "") << ')' << (settings.hilite ? hilite_none : ""); written = true; } } From 043bd11d2eaa8aeee63e28b67c465fa9c9e8da13 Mon Sep 17 00:00:00 2001 From: fuqi Date: Sun, 4 Apr 2021 18:00:30 +0800 Subject: [PATCH 2/3] fix dist map type select --- src/Parsers/ASTFunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parsers/ASTFunction.cpp b/src/Parsers/ASTFunction.cpp index c5f2a3034cd..4a68e8fde92 100644 --- a/src/Parsers/ASTFunction.cpp +++ b/src/Parsers/ASTFunction.cpp @@ -483,7 +483,7 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format if (!written && 0 == strcmp(name.c_str(), "map")) { - settings.ostr << (settings.hilite ? hilite_operator : "") << 'map(' << (settings.hilite ? hilite_none : ""); + settings.ostr << (settings.hilite ? hilite_operator : "") << "map(" << (settings.hilite ? hilite_none : ""); for (size_t i = 0; i < arguments->children.size(); ++i) { if (i != 0) From a9a01df74ab9fd5e14edce90afeb836b6f4aa67b Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Tue, 6 Apr 2021 14:38:35 +0300 Subject: [PATCH 3/3] add test --- tests/queries/0_stateless/01787_map_remote.reference | 2 ++ tests/queries/0_stateless/01787_map_remote.sql | 1 + 2 files changed, 3 insertions(+) create mode 100644 tests/queries/0_stateless/01787_map_remote.reference create mode 100644 tests/queries/0_stateless/01787_map_remote.sql diff --git a/tests/queries/0_stateless/01787_map_remote.reference b/tests/queries/0_stateless/01787_map_remote.reference new file mode 100644 index 00000000000..1c488d4418e --- /dev/null +++ b/tests/queries/0_stateless/01787_map_remote.reference @@ -0,0 +1,2 @@ +{'a':1,'b':2} +{'a':1,'b':2} diff --git a/tests/queries/0_stateless/01787_map_remote.sql b/tests/queries/0_stateless/01787_map_remote.sql new file mode 100644 index 00000000000..854eafa0a50 --- /dev/null +++ b/tests/queries/0_stateless/01787_map_remote.sql @@ -0,0 +1 @@ +SELECT map('a', 1, 'b', 2) FROM remote('127.0.0.{1,2}', system, one); \ No newline at end of file