Merge pull request #60160 from rschu1ze/bool-cast

Allow casting of bools in string representation to to true bools
This commit is contained in:
Robert Schulze 2024-02-20 17:19:02 +01:00 committed by GitHub
commit a1a45ed881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -493,10 +493,12 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
{
/// 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
/// Also don't promote domain types (like bool) because we would otherwise use the serializer of the promoted type (e.g. UInt64 for
/// bool, which does not allow 'true' and 'false' as input values)
const IDataType * type_to_parse = &type;
DataTypePtr holder;
if (type.canBePromoted() && !which_type.isFloat32())
if (type.canBePromoted() && !which_type.isFloat32() && !type.getCustomSerialization())
{
holder = type.promoteNumericType();
type_to_parse = holder.get();

View File

@ -0,0 +1 @@
select true = 'true';