Skip to content

SUMMARIZE returns error when query contains large values #9978

@jraymakers

Description

@jraymakers

What happens?

When summarize is used on a query with a result that contains values of some types close to the limits of their ranges, an error is returned.

To Reproduce

Running the following command in the CLI returns the error below:

summarize select 9223372036854775296;
Error: Invalid Input Error: Type DOUBLE with value 9.223372036854776e+18 can't be cast because the value is out of range for the destination type INT64

Equivalently, this produces the same error:

summarize select bigint from test_all_types();

Although note that the error occurs with the value 9223372036854775296, which is a bit smaller than the value 9223372036854775807 from test_all_types() (which also produces the error).

Note that the following (with the next smallest value from 9223372036854775296) does not return an error:

summarize select 9223372036854775295;

Also, negative values of some types return similar but different errors:

summarize select -9223372036854775808::bigint;
Error: Conversion Error: Type INT128 with value 9223372036854775808 can't be cast because the value is out of range for the destination type INT64

Note that the cast to BIGINT is needed to produce this error, and the following (with a value one step closer to zero) does not result in an error:

summarize select -9223372036854775807::bigint;

OS:

Mac OS X 13.5.2 (M2 chip)

DuckDB Version:

0.9.3-dev1527

DuckDB Client:

CLI

Full Name:

Jeff Raymakers

Affiliation:

MotherDuck

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions