mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 20:24:07 +00:00
Extend consistency check for ColumnObject
+ check that there arer subcolumns when there are rows
This commit is contained in:
parent
7d00b26a88
commit
d4c8021f80
@ -626,6 +626,9 @@ ColumnObject::ColumnObject(Subcolumns && subcolumns_, bool is_nullable_)
|
||||
|
||||
void ColumnObject::checkConsistency() const
|
||||
{
|
||||
if (num_rows && subcolumns.empty())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "ColumnObject is inconsistent: it has no subcolumns, but has {} rows", num_rows);
|
||||
|
||||
if (subcolumns.empty())
|
||||
return;
|
||||
|
||||
@ -642,9 +645,9 @@ void ColumnObject::checkConsistency() const
|
||||
|
||||
size_t ColumnObject::size() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
// #ifndef NDEBUG
|
||||
checkConsistency();
|
||||
#endif
|
||||
// #endif
|
||||
return num_rows;
|
||||
}
|
||||
|
||||
@ -711,6 +714,8 @@ void ColumnObject::insert(const Field & field)
|
||||
}
|
||||
|
||||
++num_rows;
|
||||
|
||||
checkConsistency();
|
||||
}
|
||||
|
||||
void ColumnObject::insertDefault()
|
||||
@ -719,6 +724,8 @@ void ColumnObject::insertDefault()
|
||||
entry->data.insertDefault();
|
||||
|
||||
++num_rows;
|
||||
|
||||
checkConsistency();
|
||||
}
|
||||
|
||||
Field ColumnObject::operator[](size_t n) const
|
||||
@ -776,6 +783,8 @@ void ColumnObject::insertRangeFrom(const IColumn & src, size_t start, size_t len
|
||||
|
||||
num_rows += length;
|
||||
finalize();
|
||||
|
||||
checkConsistency();
|
||||
}
|
||||
|
||||
void ColumnObject::popBack(size_t length)
|
||||
@ -784,6 +793,7 @@ void ColumnObject::popBack(size_t length)
|
||||
entry->data.popBack(length);
|
||||
|
||||
num_rows -= length;
|
||||
checkConsistency();
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
|
@ -1,2 +1,2 @@
|
||||
set allow_experimental_object_type=1;
|
||||
SELECT '0.02' GROUP BY GROUPING SETS (('6553.6'), (CAST(CAST('{"x" : 1}', 'Object(Nullable(\'json\'))'), 'Object(\'json\')'))) settings max_threads=1; -- { serverError NOT_IMPLEMENTED }
|
||||
SELECT '0.02' GROUP BY GROUPING SETS (('6553.6'), (CAST('{"x" : 1}', 'Object(\'json\')'))) settings max_threads=1; -- { serverError NOT_IMPLEMENTED }
|
||||
|
Loading…
Reference in New Issue
Block a user