[fix](schema change) CastStringConverter is compiled failed in g++ (#33546)

follow #32873, CastStringConverter is compiled failed in g++ for uninitialized value, which is ok in clang:
This commit is contained in:
Ashin Gau
2024-04-12 17:26:27 +08:00
committed by yiguolei
parent 1a8b1e6787
commit ae68cca07d

View File

@ -384,7 +384,7 @@ public:
to_col->resize(start_idx + rows);
auto& data = static_cast<DstColumnType*>(to_col.get())->get_data();
for (int i = 0; i < rows; ++i) {
DstCppType value;
DstCppType& value = data[start_idx + i];
auto string_value = string_col.get_data_at(i);
bool can_cast = false;
if constexpr (is_decimal_type_const<DstPrimitiveType>()) {
@ -398,9 +398,7 @@ public:
can_cast = SafeCastString<DstPrimitiveType>::safe_cast_string(
string_value.data, string_value.size, &value);
}
if (can_cast) {
data[start_idx + i] = value;
} else {
if (!can_cast) {
if (null_map == nullptr) {
return Status::InternalError("Failed to cast string '{}' to not null column",
string_value.to_string());