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

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


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

commit 719b1d897e68b056e774f03c0810b4265b15f8f8
Author: lihangyu <15605149...@163.com>
AuthorDate: Thu Nov 2 14:15:19 2023 +0800

    [Fix](thrift api) column should be converted if const before serialize to 
arrow format (#26111) (#26264)
    
    The 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 69c3d2da257..7174bb74ed8 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