[fix](function) Array_map compared offset rows one by one (#18406)
Array_map 's multi columns compare not only nested data rows to be equal,but also the offsets data must equal each other.
This commit is contained in:
@ -81,7 +81,7 @@ public:
|
||||
// offset column
|
||||
MutableColumnPtr array_column_offset;
|
||||
int nested_array_column_rows = 0;
|
||||
|
||||
const ColumnArray::Offsets64* array_offsets = nullptr;
|
||||
//2. get the result column from executed expr, and the needed is nested column of array
|
||||
Block lambda_block;
|
||||
for (int i = 0; i < arguments.size(); ++i) {
|
||||
@ -110,18 +110,25 @@ public:
|
||||
// here is the array column
|
||||
const ColumnArray& col_array = assert_cast<const ColumnArray&>(*column_array);
|
||||
const auto& col_type = assert_cast<const DataTypeArray&>(*type_array);
|
||||
|
||||
if (i == 0) {
|
||||
nested_array_column_rows = col_array.get_data_ptr()->size();
|
||||
array_offsets = &col_array.get_offsets();
|
||||
auto& off_data = assert_cast<const ColumnArray::ColumnOffsets&>(
|
||||
col_array.get_offsets_column());
|
||||
array_column_offset = off_data.clone_resized(col_array.get_offsets_column().size());
|
||||
} else {
|
||||
// select array_map((x,y)->x+y,c_array1,[0,1,2,3]) from array_test2;
|
||||
// c_array1: [0,1,2,3,4,5,6,7,8,9]
|
||||
if (nested_array_column_rows != col_array.get_data_ptr()->size()) {
|
||||
if (nested_array_column_rows != col_array.get_data_ptr()->size() ||
|
||||
(array_offsets->size() > 0 &&
|
||||
memcmp(array_offsets->data(), col_array.get_offsets().data(),
|
||||
sizeof((*array_offsets)[0]) * array_offsets->size()) != 0)) {
|
||||
return Status::InternalError(
|
||||
"in array map function, the input column nested column data rows are "
|
||||
"not equal, the first size is {}, but with {}th size is {}.",
|
||||
"in array map function, the input column size "
|
||||
"are "
|
||||
"not equal completely, nested column data rows 1st size is {}, {}th "
|
||||
"size is {}.",
|
||||
nested_array_column_rows, i + 1, col_array.get_data_ptr()->size());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user