Merge pull request #54649 from bakwc/materializedmysql_null_segfault

Fixed crash in MaterializedMySQL while using override + null field
This commit is contained in:
Kruglov Pavel 2024-07-09 07:55:28 +00:00 committed by GitHub
commit 329f9b5d8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -716,6 +716,16 @@ static void writeFieldsToColumn(
null_map_column->insertValue(0); null_map_column->insertValue(0);
} }
else
{
// Column is not null but field is null. It's possible due to overrides
if (field.isNull())
{
column_to.insertDefault();
return false;
}
}
return true; return true;
}; };
@ -791,7 +801,7 @@ static void writeFieldsToColumn(
if (write_data_to_null_map(value, index)) if (write_data_to_null_map(value, index))
{ {
const String & data = value.get<const String &>(); const String & data = value.safeGet<const String &>();
casted_string_column->insertData(data.data(), data.size()); casted_string_column->insertData(data.data(), data.size());
} }
} }