From 1eaa3cb309d089c71b16994db6b2102ac47d744d Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 16 Oct 2015 23:32:44 +0300 Subject: [PATCH] dbms: implemented method getExtremes for ColumnTuple [#METR-18474]. --- dbms/include/DB/Columns/ColumnTuple.h | 8 +++++++- .../0_stateless/00254_tuple_extremes.reference | 13 +++++++++++++ .../queries/0_stateless/00254_tuple_extremes.sql | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 dbms/tests/queries/0_stateless/00254_tuple_extremes.reference create mode 100644 dbms/tests/queries/0_stateless/00254_tuple_extremes.sql diff --git a/dbms/include/DB/Columns/ColumnTuple.h b/dbms/include/DB/Columns/ColumnTuple.h index bfbbc4c4f59..9c02edbaec6 100644 --- a/dbms/include/DB/Columns/ColumnTuple.h +++ b/dbms/include/DB/Columns/ColumnTuple.h @@ -233,7 +233,13 @@ public: void getExtremes(Field & min, Field & max) const override { - throw Exception("Method getExtremes is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); + size_t tuple_size = columns.size(); + + min = Array(tuple_size); + max = Array(tuple_size); + + for (size_t i = 0; i < tuple_size; ++i) + columns[i]->getExtremes(min.get()[i], max.get()[i]); } diff --git a/dbms/tests/queries/0_stateless/00254_tuple_extremes.reference b/dbms/tests/queries/0_stateless/00254_tuple_extremes.reference new file mode 100644 index 00000000000..67c495239b5 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00254_tuple_extremes.reference @@ -0,0 +1,13 @@ +0 (0,'2015-01-01') +1 (1,'2015-01-02') +2 (2,'2015-01-03') +3 (3,'2015-01-04') +4 (4,'2015-01-05') +5 (5,'2015-01-06') +6 (6,'2015-01-07') +7 (7,'2015-01-08') +8 (8,'2015-01-09') +9 (9,'2015-01-10') + +0 (0,'2015-01-01') +9 (9,'2015-01-10') diff --git a/dbms/tests/queries/0_stateless/00254_tuple_extremes.sql b/dbms/tests/queries/0_stateless/00254_tuple_extremes.sql new file mode 100644 index 00000000000..f87fdf93d3b --- /dev/null +++ b/dbms/tests/queries/0_stateless/00254_tuple_extremes.sql @@ -0,0 +1 @@ +SELECT number, (number, toDate('2015-01-01') + number) FROM system.numbers LIMIT 10 SETTINGS extremes = 1;