mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #60160 from rschu1ze/bool-cast
Allow casting of bools in string representation to to true bools
This commit is contained in:
commit
a1a45ed881
@ -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.
|
/// 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
|
/// 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;
|
const IDataType * type_to_parse = &type;
|
||||||
DataTypePtr holder;
|
DataTypePtr holder;
|
||||||
|
|
||||||
if (type.canBePromoted() && !which_type.isFloat32())
|
if (type.canBePromoted() && !which_type.isFloat32() && !type.getCustomSerialization())
|
||||||
{
|
{
|
||||||
holder = type.promoteNumericType();
|
holder = type.promoteNumericType();
|
||||||
type_to_parse = holder.get();
|
type_to_parse = holder.get();
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
select true = 'true';
|
Loading…
Reference in New Issue
Block a user