Commit 7a265e7
SLT: Improve error message on mismatch from inconsistent view (MaterializeInc#35080)
Inspired by
https://materializeinc.slack.com/archives/C08ACQNGSQK/p1771493850878619
Old error message:
```
SELECT ARRAY[NULL::BIGINT[], ARRAY[1::BIGINT, 2::BIGINT]];
InconsistentViewOutcome:test/sqllogictest/arrays.slt:1467
expected from query: Success
actually from indexed view: PlanFailure { error: db error
Caused by:
ERROR: Evaluation error: number of array elements (1) does not match declared cardinality (0)
Stack backtrace:
0: <anyhow::Error as core::convert::From<tokio_postgres::error::Error>>::from
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.101/src/backtrace.rs:27:14
1: <tokio_postgres::error::Error as core::convert::Into<anyhow::Error>>::into
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:778:9
2: <anyhow::kind::Trait>::new::<tokio_postgres::error::Error>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.101/src/kind.rs:95:15
3: <mz_sqllogictest::runner::RunnerInner>::execute_query::{closure#0}
at ./src/sqllogictest/src/runner.rs:1580:40
4: <mz_sqllogictest::runner::RunnerInner>::execute_view::{closure#0}
at ./src/sqllogictest/src/runner.rs:1761:18
5: <mz_sqllogictest::runner::RunnerInner>::run_query::{closure#0}
at ./src/sqllogictest/src/runner.rs:1805:34
6: <mz_sqllogictest::runner::RunnerInner>::run_record::{closure#0}
at ./src/sqllogictest/src/runner.rs:1385:22
7: <mz_sqllogictest::runner::Runner>::run_record::{closure#0}
at ./src/sqllogictest/src/runner.rs:793:18
8: mz_sqllogictest::runner::run_string::{closure#0}
at ./src/sqllogictest/src/runner.rs:2124:14
9: mz_sqllogictest::runner::run_file::{closure#0}
at ./src/sqllogictest/src/runner.rs:2175:83
10: sqllogictest::main::{closure#0}
at ./src/sqllogictest/src/bin/sqllogictest.rs:231:71
11: <core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>> as core::future::future::Future>::poll
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:133:9
12: <tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>> as core::future::future::Future>::poll
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-0.1.44/src/instrument.rs:321:15
13: <tokio::runtime::park::CachedParkThread>::block_on::<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>::{closure#0}
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/park.rs:285:71
14: tokio::task::coop::with_budget::<core::task::poll::Poll<std::process::ExitCode>, <tokio::runtime::park::CachedParkThread>::block_on<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>::{closure#0}>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/task/coop/mod.rs:167:5
15: tokio::task::coop::budget::<core::task::poll::Poll<std::process::ExitCode>, <tokio::runtime::park::CachedParkThread>::block_on<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>::{closure#0}>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/task/coop/mod.rs:133:5
16: <tokio::runtime::park::CachedParkThread>::block_on::<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/park.rs:285:31
17: <tokio::runtime::context::blocking::BlockingRegionGuard>::block_on::<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/context/blocking.rs:66:14
18: <tokio::runtime::scheduler::multi_thread::MultiThread>::block_on::<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>::{closure#0}
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/scheduler/multi_thread/mod.rs:87:22
19: tokio::runtime::context::runtime::enter_runtime::<<tokio::runtime::scheduler::multi_thread::MultiThread>::block_on<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>::{closure#0}, std::process::ExitCode>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/context/runtime.rs:65:16
20: <tokio::runtime::scheduler::multi_thread::MultiThread>::block_on::<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
21: <tokio::runtime::runtime::Runtime>::block_on_inner::<core::pin::Pin<alloc::boxed::Box<sqllogictest::main::{closure#0}>>>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/runtime.rs:370:50
22: <tokio::runtime::runtime::Runtime>::block_on::<sqllogictest::main::{closure#0}>
at /home/deen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/runtime/runtime.rs:340:18
23: sqllogictest::main
at ./src/sqllogictest/src/bin/sqllogictest.rs:313:15
24: <fn() -> std::process::ExitCode as core::ops::function::FnOnce<()>>::call_once
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
25: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:166:18
26: std::rt::lang_start::<std::process::ExitCode>::{closure#0}
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:206:18
27: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/core/src/ops/function.rs:287:21
28: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panicking.rs:581:40
29: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panicking.rs:544:19
30: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panic.rs:359:14
31: std::rt::lang_start_internal::{closure#0}
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/rt.rs:175:24
32: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panicking.rs:581:40
33: std::panicking::catch_unwind::<isize, std::rt::lang_start_internal::{closure#0}>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panicking.rs:544:19
34: std::panic::catch_unwind::<std::rt::lang_start_internal::{closure#0}, isize>
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/panic.rs:359:14
35: std::rt::lang_start_internal
at /rustc/842bd5be253e17831e318fdbd9d01d716557cc75/library/std/src/rt.rs:171:5
36: std::rt::lang_start::<std::process::ExitCode>
at /home/deen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:205:5
37: main
38: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
39: __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
40: _start, location: Location { file: "test/sqllogictest/arrays.slt", line: 1467 } }
```
New error message:
```
SELECT ARRAY[NULL::BIGINT[], ARRAY[1::BIGINT, 2::BIGINT]];
InconsistentViewOutcome:test/sqllogictest/arrays.slt:1467
expected from query: Success
actually from indexed view: PlanFailure:test/sqllogictest/arrays.slt:1467:
error does not match expected pattern:
expected: /db error: ERROR: number of array elements \(1\) does not match declared cardinality \(0\)/
actual: db error: ERROR: Evaluation error: number of array elements (1) does not match declared cardinality (0)
```1 parent 543c7e9 commit 7a265e7
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
309 | | - | |
| 308 | + | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| |||
1577 | 1577 | | |
1578 | 1578 | | |
1579 | 1579 | | |
1580 | | - | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1581 | 1585 | | |
1582 | 1586 | | |
1583 | 1587 | | |
| |||
1702 | 1706 | | |
1703 | 1707 | | |
1704 | 1708 | | |
1705 | | - | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
1706 | 1714 | | |
1707 | 1715 | | |
1708 | 1716 | | |
| |||
0 commit comments