Optimization pass AggregateStatistics
changes type of output from Int64
to UInt64
#2673
Labels
AggregateStatistics
changes type of output from Int64
to UInt64
#2673
Describe the bug
AggregateStatistics
is a physical optimizer pass that changes the output of aggregates such asCOUNT
to a constant based on statistics.#2636 changes the type of count() output to be
Int64
but the optimizer pass was not also changed. This means that if the optimization is triggered, the output type of a query with Count in it may be converted toUInt64
instead ofInt64
cc @liukun4515
To Reproduce
This can be shown
This test fails on master (note the error about UInt64 but expected Int64):
---- physical_optimizer::aggregate_statistics::tests::test_count_partial_indirect_child stdout ----
Error: ArrowError(InvalidArgumentError("column types must match schema types, expected UInt64 but found Int64 at column index 0"))
thread 'physical_optimizer::aggregate_statistics::tests::test_count_partial_indirect_child' panicked at 'assertion failed:
(left == right)
left:
1
,right:
0
: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/test/src/lib.rs:186:5stack backtrace:
0: rust_begin_unwind
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
2: core::panicking::assert_failed_inner
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:219:23
3: core::panicking::assert_failed
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:182:5
4: test::assert_test_result
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/test/src/lib.rs:186:5
5: datafusion::physical_optimizer::aggregate_statistics::tests::test_count_partial_indirect_child::{{closure}}
at ./src/physical_optimizer/aggregate_statistics.rs:392:11
6: core::ops::function::FnOnce::call_once
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
7: core::ops::function::FnOnce::call_once
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace.Expected behavior
The output type should not be changed, and the test should pass
Additional context
This was caught by some of IOx's tests (see https://github.com/influxdata/influxdb_iox/pull/4743)
The text was updated successfully, but these errors were encountered: