Skip to content

Integer type inference seems confusing #51236

@crakjie

Description

@crakjie

Integer type inference seems incorect incorect

select  [-4741124612489978151, -3236599669630092879, 5607475129431807682]

thow this exception

Received exception from server (version 23.3.2):
Code: 386. DB::Exception: Received from localhost:9101. DB::Exception: There is no supertype for types UInt64, Int64 because some of them are signed integers and some are unsigned integers, but there is no signed integer type, that can exactly represent all required unsigned integer values: While processing transform(commit, [-4741124612489978151, -3236599669630092879, 5607475129431807682], range(toInt64(3))). (NO_COMMON_TYPE)

while in fact all value could fit in Int64.
exemple

SELECT [-4741124612489978151, -3236599669630092879, toInt64(5607475129431807682)]


┌─array(-4741124612489978151, -3236599669630092879, toInt64(5607475129431807682))─┐
│ [-4741124612489978151,-3236599669630092879,5607475129431807682]                 │
└─────────────────────────────────────────────────────────────────────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    unexpected behaviourResult is unexpected, but not entirely wrong at the same time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions