Fix empty tuple ALTER

This commit is contained in:
Amos Bird 2024-11-09 13:04:39 +08:00
parent 49e41f23ee
commit bf58f46808
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
4 changed files with 18 additions and 0 deletions

View File

@ -1033,6 +1033,9 @@ private:
size_t tuple_size,
size_t input_rows_count) const
{
if (0 == tuple_size)
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Comparison of zero-sized tuples is not implemented");
ColumnsWithTypeAndName less_columns(tuple_size);
ColumnsWithTypeAndName equal_columns(tuple_size - 1);
ColumnsWithTypeAndName tmp_columns(2);

View File

@ -668,6 +668,9 @@ private:
temporary_columns[0] = arguments[0];
size_t tuple_size = type1.getElements().size();
if (tuple_size == 0)
return ColumnTuple::create(input_rows_count);
Columns tuple_columns(tuple_size);
for (size_t i = 0; i < tuple_size; ++i)

View File

@ -0,0 +1 @@
() 2

View File

@ -0,0 +1,11 @@
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 Tuple(), c1 int) ENGINE = Memory();
INSERT INTO t0 VALUES ((), 1);
ALTER TABLE t0 UPDATE c0 = (), c1 = 2 WHERE EXISTS (SELECT 1);
SELECT * FROM t0;
DROP TABLE t0;