Skip to content

Partial aggregate error: column types must match schema types, expected Decimal128\(20, 3\) but found Decimal128\(38, 10\) at column index 1 #11832

@alamb

Description

@alamb

Describe the bug

When the partial aggregate skipping logic added in #11627 is invoked for decimal values it generates an error like

query error DataFusion error: External error: Arrow error: Invalid argument error: column types must match schema types, expected Decimal128(20, 3) but found Decimal128(38, 10) at column index 1

To Reproduce

Add this to the end of datafusion/sqllogictest/test_files/aggregate_skip_partial.slt

statement ok
DROP TABLE aggregate_test_100_null;

# Test for aggregate functions with different intermediate types
# Need more than 10 values to trigger skipping
statement ok
CREATE TABLE decimal_table(i int, d decimal(10,3)) as
VALUES (1, 1.1), (2, 2.2), (3, 3.3), (2, 4.4), (1, 5.5);

statement ok
CREATE TABLE t(id int) as values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);

query error DataFusion error: External error: Arrow error: Invalid argument error: column types must match schema types, expected Decimal128\(20, 3\) but found Decimal128\(38, 10\) at column index 1
SELECT i, sum(d)
FROM decimal_table CROSS JOIN t
GROUP BY i
ORDER BY i;

statement ok
DROP TABLE decimal_table;

Expected behavior

No response

Additional context

I found this while testing

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions