[fix](array-type) fix get_data_at for zero element array #13225
Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
This commit is contained in:
@ -150,9 +150,11 @@ StringRef ColumnArray::get_data_at(size_t n) const {
|
||||
* For arrays of strings and arrays of arrays, the resulting chunk of memory may not be one-to-one correspondence with the elements,
|
||||
* since it contains only the data laid in succession, but not the offsets.
|
||||
*/
|
||||
|
||||
size_t offset_of_first_elem = offset_at(n);
|
||||
StringRef first = get_data().get_data_at(offset_of_first_elem);
|
||||
StringRef first;
|
||||
if (offset_of_first_elem < get_data().size()) {
|
||||
first = get_data().get_data_at(offset_of_first_elem);
|
||||
}
|
||||
|
||||
size_t array_size = size_at(n);
|
||||
if (array_size == 0) {
|
||||
|
||||
@ -197,8 +197,8 @@ std::string VLiteral::debug_string() const {
|
||||
out << "VLiteral (name = " << _expr_name;
|
||||
out << ", type = " << _data_type->get_name();
|
||||
out << ", value = ";
|
||||
if (_column_ptr.get()->size() > 0) {
|
||||
StringRef ref = _column_ptr.get()->get_data_at(0);
|
||||
if (_column_ptr->size() > 0) {
|
||||
StringRef ref = _column_ptr->get_data_at(0);
|
||||
if (ref.data == nullptr) {
|
||||
out << "null";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user