Skip to content

bug(frontend): unnest cause panic #14734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KeXiangWang opened this issue Jan 23, 2024 · 1 comment · Fixed by #14748
Closed

bug(frontend): unnest cause panic #14734

KeXiangWang opened this issue Jan 23, 2024 · 1 comment · Fixed by #14748
Labels
type/bug Type: Bug. Only for issues.
Milestone

Comments

@KeXiangWang
Copy link
Contributor

KeXiangWang commented Jan 23, 2024

Describe the bug

Still part of subquery. Not sure whether retated to #14423

Error message/log

part of the error message

thread 'rw-main' panicked at src/frontend/src/expr/subquery.rs:101:9:
internal error: entered unreachable code: Subquery Subquery { kind: Array, query: BoundQuery { body: Query(BoundQuery { body: Select(BoundSelect { distinct: All, select_items: [GenerateSeries(0:Int32, -2:Int32, 1:Int32)], aliases: [Some("generate_series_1")], from: None, where_clause: None, group_by: GroupKey([]), having: None, schema: Schema { fields: [generate_series_1:Int32] } }), order: [], limit: None, offset: None, with_ties: false, extra_order_exprs: [] }), order: [], limit: None, offset: None, with_ties: false, extra_order_exprs: [] } } has not been unnested
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/panicking.rs:72:14
   2: <risingwave_frontend::expr::subquery::Subquery as risingwave_frontend::expr::Expr>::to_expr_proto
             at ./src/frontend/src/expr/subquery.rs:101:9
   3: <risingwave_frontend::expr::ExprImpl as risingwave_frontend::expr::Expr>::to_expr_proto
             at ./src/frontend/src/expr/mod.rs:108:45
   4: core::ops::function::FnMut::call_mut
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/ops/function.rs:166:5
   5: core::iter::adapters::map::map_fold::{{closure}}
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/iter/adapters/map.rs:85:28
   6: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/slice/iter/macros.rs:232:27
   7: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/iter/adapters/map.rs:125:9
   8: core::iter::traits::iterator::Iterator::for_each
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/iter/traits/iterator.rs:858:9
   9: alloc::vec::Vec<T,A>::extend_trusted
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/alloc/src/vec/mod.rs:2923:17
  10: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/alloc/src/vec/spec_extend.rs:26:9
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/alloc/src/vec/spec_from_iter_nested.rs:62:9
  12: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/alloc/src/vec/spec_from_iter.rs:33:9
  13: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/alloc/src/vec/mod.rs:2791:9
  14: core::iter::traits::iterator::Iterator::collect
             at /rustc/e4c626dd9a17a23270bf8e7158e59cf2b9c04840/library/core/src/iter/traits/iterator.rs:2054:9
  15: <risingwave_frontend::expr::function_call::FunctionCall as risingwave_frontend::expr::Expr>::to_expr_proto
             at ./src/frontend/src/expr/function_call.rs:300:27
  16: <risingwave_frontend::expr::ExprImpl as risingwave_frontend::expr::Expr>::to_expr_proto
             at ./src/frontend/src/expr/mod.rs:108:45

To Reproduce

SELECT anon_1.f1 AS "IntegerRange(0, -2, 1)" 
FROM unnest(CASE WHEN (nullif(1, 0) IS NOT NULL AND sign(1) = sign( -2 - 0)) THEN array_remove(array((SELECT generate_series(0,  -2, 1) AS generate_series_1)),  -2) ELSE CAST(ARRAY[] AS SMALLINT[]) END) AS anon_1(f1);

Expected behavior

At least not panic

How did you deploy RisingWave?

No response

The version of RisingWave

657b8ab (newest main)

Additional context

No response

@KeXiangWang KeXiangWang added the type/bug Type: Bug. Only for issues. label Jan 23, 2024
@github-actions github-actions bot added this to the release-1.7 milestone Jan 23, 2024
@chenzl25
Copy link
Contributor

The error should be reported as Not supported: use subuqery in a table function. We can't support subquery in tablefunction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: Bug. Only for issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants