This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0-var
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0-var by this push:
     new f980cb76a5e [Fix](thrift api) column should be converted if const 
before serialize to arrow format (#26119)
f980cb76a5e is described below

commit f980cb76a5e78e6cb689fa95852bc4ad5e4f9241
Author: lihangyu <15605149...@163.com>
AuthorDate: Mon Oct 30 19:36:35 2023 +0800

    [Fix](thrift api) column should be converted if const before serialize to 
arrow format (#26119)
    
    The above sql `select null;` from thrift api will cause crash in 
`write_column_to_arrow` since it's column const,
    we should convert to full column
---
 be/src/util/arrow/block_convertor.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/be/src/util/arrow/block_convertor.cpp 
b/be/src/util/arrow/block_convertor.cpp
index a99d8ee54d6..77a9fd9d851 100644
--- a/be/src/util/arrow/block_convertor.cpp
+++ b/be/src/util/arrow/block_convertor.cpp
@@ -391,8 +391,14 @@ Status 
FromBlockConverter::convert(std::shared_ptr<arrow::RecordBatch>* out) {
             return to_status(arrow_st);
         }
         _cur_builder = builder.get();
-        _cur_type->get_serde()->write_column_to_arrow(*_cur_col, nullptr, 
_cur_builder, _cur_start,
-                                                      _cur_start + _cur_rows);
+        auto column = _cur_col->convert_to_full_column_if_const();
+        try {
+            _cur_type->get_serde()->write_column_to_arrow(*column, nullptr, 
_cur_builder,
+                                                          _cur_start, 
_cur_start + _cur_rows);
+        } catch (std::exception& e) {
+            return Status::InternalError("Fail to convert block data to arrow 
data, error: {}",
+                                         e.what());
+        }
         arrow_st = _cur_builder->Finish(&_arrays[_cur_field_idx]);
         if (!arrow_st.ok()) {
             return to_status(arrow_st);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to