@@ -326,15 +326,19 @@ Status DataTypeArraySerDe::read_column_from_arrow(IColumn& column, const arrow::
326326 auto arrow_offsets_array = concrete_array->offsets ();
327327 auto * arrow_offsets = dynamic_cast <arrow::Int32Array*>(arrow_offsets_array.get ());
328328 auto prev_size = offsets_data.back ();
329- int32_t arrow_nested_start_offset;
330- int32_t arrow_nested_end_offset;
331- const auto * offsets_raw_data = arrow_offsets->raw_values ();
332- memcpy (&arrow_nested_start_offset, offsets_raw_data + start, sizeof (int32_t ));
333- memcpy (&arrow_nested_end_offset, offsets_raw_data + end, sizeof (int32_t ));
329+ const auto * base_offsets_ptr = reinterpret_cast <const uint8_t *>(arrow_offsets->raw_values ());
330+ const size_t offset_element_size = sizeof (int32_t );
331+ int32_t arrow_nested_start_offset = 0 ;
332+ int32_t arrow_nested_end_offset = 0 ;
333+ const uint8_t * start_offset_ptr = base_offsets_ptr + start * offset_element_size;
334+ const uint8_t * end_offset_ptr = base_offsets_ptr + end * offset_element_size;
335+ memcpy (&arrow_nested_start_offset, start_offset_ptr, offset_element_size);
336+ memcpy (&arrow_nested_end_offset, end_offset_ptr, offset_element_size);
334337
335338 for (auto i = start + 1 ; i < end + 1 ; ++i) {
336- int32_t current_offset;
337- memcpy (¤t_offset, offsets_raw_data + i, sizeof (int32_t ));
339+ int32_t current_offset = 0 ;
340+ const uint8_t * current_offset_ptr = base_offsets_ptr + i * offset_element_size;
341+ memcpy (¤t_offset, current_offset_ptr, offset_element_size);
338342 // convert to doris offset, start from offsets.back()
339343 offsets_data.emplace_back (prev_size + current_offset - arrow_nested_start_offset);
340344 }
@@ -395,17 +399,17 @@ Status DataTypeArraySerDe::_write_column_to_mysql(const IColumn& column,
395399 return Status::OK ();
396400}
397401
398- Status DataTypeArraySerDe::write_column_to_mysql_binary (const IColumn& column,
399- MysqlRowBinaryBuffer & row_buffer,
400- int64_t row_idx, bool col_const,
401- const FormatOptions& options) const {
402+ Status DataTypeArraySerDe::write_column_to_mysql (const IColumn& column,
403+ MysqlRowBuffer< true > & row_buffer, int64_t row_idx ,
404+ bool col_const,
405+ const FormatOptions& options) const {
402406 return _write_column_to_mysql (column, row_buffer, row_idx, col_const, options);
403407}
404408
405- Status DataTypeArraySerDe::write_column_to_mysql_text (const IColumn& column,
406- MysqlRowTextBuffer & row_buffer,
407- int64_t row_idx, bool col_const,
408- const FormatOptions& options) const {
409+ Status DataTypeArraySerDe::write_column_to_mysql (const IColumn& column,
410+ MysqlRowBuffer< false > & row_buffer, int64_t row_idx ,
411+ bool col_const,
412+ const FormatOptions& options) const {
409413 return _write_column_to_mysql (column, row_buffer, row_idx, col_const, options);
410414}
411415
0 commit comments