This is an automated email from the ASF dual-hosted git repository. zhangstar333 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new d7c0711012e [Fix](debug) Support dump const nullable Column from Block (#44029) d7c0711012e is described below commit d7c0711012e0bc3c41e187546ec5316fc0aae2a1 Author: zclllhhjj <zhaochan...@selectdb.com> AuthorDate: Wed Nov 20 12:48:58 2024 +0800 [Fix](debug) Support dump const nullable Column from Block (#44029) ### What problem does this PR solve? Issue Number: close #xxx Related PR: https://github.com/apache/doris/pull/41175 --- be/src/vec/columns/column.h | 4 +++- be/src/vec/columns/column_const.h | 3 ++- be/src/vec/columns/column_nullable.h | 1 + be/src/vec/core/block.cpp | 17 +++++++---------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h index 975827bd13e..ce155aefad2 100644 --- a/be/src/vec/columns/column.h +++ b/be/src/vec/columns/column.h @@ -570,8 +570,10 @@ public: /// Various properties on behaviour of column type. - /// True if column contains something nullable inside. It's true for ColumnNullable, can be true or false for ColumnConst, etc. + /// It's true for ColumnNullable only. virtual bool is_nullable() const { return false; } + /// It's true for ColumnNullable, can be true or false for ColumnConst, etc. + virtual bool is_concrete_nullable() const { return false; } virtual bool is_bitmap() const { return false; } diff --git a/be/src/vec/columns/column_const.h b/be/src/vec/columns/column_const.h index d1d9c6e047b..980d9d64148 100644 --- a/be/src/vec/columns/column_const.h +++ b/be/src/vec/columns/column_const.h @@ -259,7 +259,8 @@ public: return false; } - // bool is_nullable() const override { return is_column_nullable(*data); } + // ColumnConst is not nullable, but may be concrete nullable. + bool is_concrete_nullable() const override { return is_column_nullable(*data); } bool only_null() const override { return data->is_null_at(0); } bool is_numeric() const override { return data->is_numeric(); } bool is_fixed_and_contiguous() const override { return data->is_fixed_and_contiguous(); } diff --git a/be/src/vec/columns/column_nullable.h b/be/src/vec/columns/column_nullable.h index 6096fd4b669..0e5e104dce9 100644 --- a/be/src/vec/columns/column_nullable.h +++ b/be/src/vec/columns/column_nullable.h @@ -332,6 +332,7 @@ public: void set_datetime_type() override { get_nested_column().set_datetime_type(); } bool is_nullable() const override { return true; } + bool is_concrete_nullable() const override { return true; } bool is_bitmap() const override { return get_nested_column().is_bitmap(); } bool is_hll() const override { return get_nested_column().is_hll(); } bool is_column_decimal() const override { return get_nested_column().is_column_decimal(); } diff --git a/be/src/vec/core/block.cpp b/be/src/vec/core/block.cpp index b15b83cf77e..6083be02877 100644 --- a/be/src/vec/core/block.cpp +++ b/be/src/vec/core/block.cpp @@ -509,16 +509,13 @@ std::string Block::dump_data(size_t begin, size_t row_limit, bool allow_null_mis continue; } std::string s; - if (data[i].column) { - if (data[i].type->is_nullable() && !data[i].column->is_nullable()) { - if (is_column_const(*data[i].column)) { - s = data[i].to_string(0); - } else { - assert(allow_null_mismatch); - s = assert_cast<const DataTypeNullable*>(data[i].type.get()) - ->get_nested_type() - ->to_string(*data[i].column, row_num); - } + if (data[i].column) { // column may be const + // for code inside `default_implementation_for_nulls`, there's could have: type = null, col != null + if (data[i].type->is_nullable() && !data[i].column->is_concrete_nullable()) { + assert(allow_null_mismatch); + s = assert_cast<const DataTypeNullable*>(data[i].type.get()) + ->get_nested_type() + ->to_string(*data[i].column, row_num); } else { s = data[i].to_string(row_num); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org