From 0f05b0ac9ae07ce3a91b47c226609e3d736f0db9 Mon Sep 17 00:00:00 2001 From: hexiaoting Date: Sat, 23 Jan 2021 22:53:08 +0800 Subject: [PATCH] Add Const column test cases for mapContains/Keys/Values --- src/Functions/map.cpp | 2 ++ tests/queries/0_stateless/01651_map_functions.reference | 3 ++- tests/queries/0_stateless/01651_map_functions.sql | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Functions/map.cpp b/src/Functions/map.cpp index 84cd0f7ede7..83fc822aa11 100644 --- a/src/Functions/map.cpp +++ b/src/Functions/map.cpp @@ -177,6 +177,8 @@ public: return std::make_shared(); } + bool useDefaultImplementationForConstants() const override { return true; } + ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override { const ColumnMap * col_map = typeid_cast(arguments[0].column.get()); diff --git a/tests/queries/0_stateless/01651_map_functions.reference b/tests/queries/0_stateless/01651_map_functions.reference index 0689144977c..cbbadbb5162 100644 --- a/tests/queries/0_stateless/01651_map_functions.reference +++ b/tests/queries/0_stateless/01651_map_functions.reference @@ -17,4 +17,5 @@ [1000] [1001] [1002] -{'aa':4,'44':5} ['aa','44'] [4,5] +{'aa':4,'bb':5} ['aa','bb'] [4,5] +{'aa':4,'bb':5} 1 0 diff --git a/tests/queries/0_stateless/01651_map_functions.sql b/tests/queries/0_stateless/01651_map_functions.sql index dfc08851e5c..062547ea620 100644 --- a/tests/queries/0_stateless/01651_map_functions.sql +++ b/tests/queries/0_stateless/01651_map_functions.sql @@ -23,4 +23,5 @@ drop table if exists table_map; -- Const column -select map( 'aa', 4, '44' , 5) as c, mapKeys(c), mapValues(c); +select map( 'aa', 4, 'bb' , 5) as m, mapKeys(m), mapValues(m); +select map( 'aa', 4, 'bb' , 5) as m, mapContains(m, 'aa'), mapContains(m, 'k');