Try a different approach

This commit is contained in:
Raúl Marín 2024-01-12 10:45:36 +00:00
parent 9d8290cc50
commit 8e5cd5e6b0

View File

@ -492,10 +492,11 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
if (src.getType() == Field::Types::String) if (src.getType() == Field::Types::String)
{ {
/// Promote data type to avoid overflows. Note that overflows in the largest data type are still possible. /// Promote data type to avoid overflows. Note that overflows in the largest data type are still possible.
/// But don't promote Float32, since we want to keep the exact same value
const IDataType * type_to_parse = &type; const IDataType * type_to_parse = &type;
DataTypePtr holder; DataTypePtr holder;
if (type.canBePromoted()) if (type.canBePromoted() && !which_type.isFloat32())
{ {
holder = type.promoteNumericType(); holder = type.promoteNumericType();
type_to_parse = holder.get(); type_to_parse = holder.get();