From 187cc83702fd2e4fee40e98ce1e393386a23120f Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Tue, 10 Dec 2019 14:19:11 +0300 Subject: [PATCH] update tuple comparison. --- dbms/src/Functions/FunctionsComparison.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dbms/src/Functions/FunctionsComparison.h b/dbms/src/Functions/FunctionsComparison.h index 76d73bc5462..a72f0cbafdf 100644 --- a/dbms/src/Functions/FunctionsComparison.h +++ b/dbms/src/Functions/FunctionsComparison.h @@ -960,6 +960,9 @@ private: void executeTupleEqualityImpl(Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size, size_t input_rows_count) { + if (0 == tuple_size) + throw Exception("Comparison of zero-sized tuples is not implemented.", ErrorCodes::NOT_IMPLEMENTED); + auto func_compare = ComparisonFunction::create(context); auto func_convolution = ConvolutionFunction::create(context); @@ -979,6 +982,13 @@ private: impl->execute(tmp_block, {i * 3, i * 3 + 1}, i * 3 + 2, input_rows_count); } + if (tuple_size == 1) + { + /// Do not call AND for single-element tuple. + block.getByPosition(result).column = tmp_block.getByPosition(2).column; + return; + } + /// Logical convolution. tmp_block.insert({ nullptr, std::make_shared(), "" });