Fix use-after-move

This commit is contained in:
Alexey Milovidov 2023-12-23 08:23:15 +01:00
parent ad697a0eac
commit 468b5e2813
3 changed files with 14 additions and 13 deletions

View File

@ -115,13 +115,14 @@ namespace JSONUtils
return {loadAtPosition(in, memory, pos), number_of_rows};
}
std::pair<bool, size_t> fileSegmentationEngineJSONEachRow(ReadBuffer & in, DB::Memory<> & memory, size_t min_bytes, size_t max_rows)
std::pair<bool, size_t> fileSegmentationEngineJSONEachRow(
ReadBuffer & in, DB::Memory<> & memory, size_t min_bytes, size_t max_rows)
{
return fileSegmentationEngineJSONEachRowImpl<'{', '}'>(in, memory, min_bytes, 1, max_rows);
}
std::pair<bool, size_t>
fileSegmentationEngineJSONCompactEachRow(ReadBuffer & in, DB::Memory<> & memory, size_t min_bytes, size_t min_rows, size_t max_rows)
std::pair<bool, size_t> fileSegmentationEngineJSONCompactEachRow(
ReadBuffer & in, DB::Memory<> & memory, size_t min_bytes, size_t min_rows, size_t max_rows)
{
return fileSegmentationEngineJSONEachRowImpl<'[', ']'>(in, memory, min_bytes, min_rows, max_rows);
}

View File

@ -145,13 +145,13 @@ private:
}
write_helper.finalize();
/// Same as the normal `ColumnString` branch
has_column_string = true;
data[i] = &converted_col_str->getChars();
offsets[i] = &converted_col_str->getOffsets();
/// Keep the pointer alive
converted_col_ptrs[i] = std::move(converted_col_str);
/// Same as the normal `ColumnString` branch
has_column_string = true;
data[i] = &converted_col_ptrs[i]->getChars();
offsets[i] = &converted_col_ptrs[i]->getOffsets();
}
}

View File

@ -108,13 +108,13 @@ public:
}
write_helper.finalize();
/// Same as the normal `ColumnString` branch
has_column_string = true;
data[i - 1] = &converted_col_str->getChars();
offsets[i - 1] = &converted_col_str->getOffsets();
/// Keep the pointer alive
converted_col_ptrs[i - 1] = std::move(converted_col_str);
/// Same as the normal `ColumnString` branch
has_column_string = true;
data[i - 1] = &converted_col_ptrs[i - 1]->getChars();
offsets[i - 1] = &converted_col_ptrs[i - 1]->getOffsets();
}
}