Skip to content

Implement array_union - #7897

Merged
alamb merged 12 commits into
apache:mainfrom
edmondop:issue-6981
Nov 13, 2023
Merged

Implement array_union#7897
alamb merged 12 commits into
apache:mainfrom
edmondop:issue-6981

Conversation

@edmondop

@edmondopedmondop commented Oct 21, 2023

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes#6981

Rationale for this change

Support additional array_union SQL keyword

Are these changes tested?

Additional slt tests have been added, obviously they do not pass until duplication issue is solved :)

@github-actionsgithub-actionsBot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) labels Oct 21, 2023

@compheadcomphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @edmondop please check some comments

Comment threaddatafusion/physical-expr/src/array_expressions.rs
Comment threaddocs/source/user-guide/expressions.md Outdated
Comment threaddatafusion/sqllogictest/test_files/array.slt
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
@edmondopedmondop changed the title Initial implementation of array union without deduplicationArray_union implementationNov 7, 2023
@edmondop
edmondop marked this pull request as ready for review November 7, 2023 23:28

@jayzhan211jayzhan211 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
fn union_generic_lists<OffsetSize: OffsetSizeTrait>(
l: &GenericListArray<OffsetSize>,
r: &GenericListArray<OffsetSize>,
) -> Result<GenericListArray<OffsetSize>, DataFusionError> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer Result<GenericListArray<OffsetSize>>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 648ae5d

Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
(_, DataType::Null) => Ok(array1.clone()),
(DataType::List(_), DataType::List(_)) => {
check_datatypes("array_union", &[&array1, &array2])?;
let list1 = array1.as_list::<i32>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer datafusion::common::cast as_list_array and as_large_list_array

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datafusion::common::cast and arrow::array::cast are doing the similar thing. The difference is that common::cast return datafusion error, while arrow::array::cast return Arror error. To me, return datafusion error in datafusion project make much more senses for me. Also, mixing these two casting is quite messy, we can have arrow casting inside common::cast and call common::cast for other crate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found that arrow::array::cast does not return Result<>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, I don't have strong opinion on which to use yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we directly use as_list_array here?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the offset i32 branch you mean @Weijun-H ? I like the fact that the code has the same structure for LargeList and List

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I think as_list_array can avoid panic because it returns the Return type.

Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
Comment threaddatafusion/sqllogictest/test_files/array.slt
Comment threaddatafusion/expr/src/built_in_function.rs
Comment threaddatafusion/physical-expr/src/array_expressions.rs Outdated
(_, DataType::Null) => Ok(array1.clone()),
(DataType::List(_), DataType::List(_)) => {
check_datatypes("array_union", &[&array1, &array2])?;
let list1 = array1.as_list::<i32>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datafusion::common::cast and arrow::array::cast are doing the similar thing. The difference is that common::cast return datafusion error, while arrow::array::cast return Arror error. To me, return datafusion error in datafusion project make much more senses for me. Also, mixing these two casting is quite messy, we can have arrow casting inside common::cast and call common::cast for other crate.

Comment threaddatafusion/sqllogictest/test_files/array.slt
Comment threaddatafusion/expr/src/expr_fn.rs Outdated
@edmondop
edmondopforce-pushed the issue-6981 branch 3 times, most recently from 9237fb4 to 4c1bcefCompareNovember 8, 2023 17:03

@compheadcomphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @edmondop for keep improving the PR
Please also test

  • different datatypes, fixed len(int, float, etc) / variable(strings, inner arrays)
  • nulls
  • empty arrays

we can put tests for every type and figure out if this needs to be fixed within this PR or we can create a followup PR

@edmondop

Copy link
Copy Markdown
ContributorAuthor

Thanks @edmondop for keep improving the PR Please also test

  • different datatypes, fixed len(int, float, etc) / variable(strings, inner arrays)
  • nulls
  • empty arrays

we can put tests for every type and figure out if this needs to be fixed within this PR or we can create a followup PR

Will do! Are the other cases for empty arrays that aren't there @comphead ?

@comphead

Copy link
Copy Markdown
Contributor

Thanks @edmondop for keep improving the PR Please also test

  • different datatypes, fixed len(int, float, etc) / variable(strings, inner arrays)
  • nulls
  • empty arrays

we can put tests for every type and figure out if this needs to be fixed within this PR or we can create a followup PR

Will do! Are the other cases for empty arrays that aren't there @comphead ?

Now I can see

select array_union([1,2,3], []);

would be very nice to see

select array_union([], []);
select array_union([[]], []);
select array_union([[null]], []);
select array_union([null], [null]);
select array_union([[]], [[]]);
select array_union(null, []);
select array_union(null, null);

@edmondop

edmondop commented Nov 8, 2023

Copy link
Copy Markdown
ContributorAuthor

Adding these two tests break the sqltests, but it doesn't seem to be caused by my code. I checked in the backtrace and there is nothing that refers array_expression.rs

select array_union([[]], []);

The stacktrace is the following

thread 'tokio-runtime-worker' panicked at datafusion/common/src/scalar.rs:1513:26:
internal error: entered unreachable code
thread 'tokio-runtime-worker' panicked at datafusion/common/src/scalar.rs:1513:26:
internal error: entered unreachable code
stack backtrace:
stack backtrace:
0: rust_begin_unwind
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs:619:5
0: rust_begin_unwind
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs:619:5
1: core::panicking::panic_fmt
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panicking.rs:72 1: core::panicking::panic_fmt
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panicking.rs:72:14
:14
2: core::panicking::panic
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panicking.rs:127:5
2: core::panicking::panic
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panicking.rs:127:5
3: datafusion_common::scalar::ScalarValue::iter_to_null_array::{{closure}} 3: datafusion_common::scalar::ScalarValue::iter_to_null_array::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1513:26
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1513:26
4: <core::iter::adapters:: 4: <core::iter::adapters::peekable::Peekable<I> as core::iter::traits::iterator::Iterator>::fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/peekable.rs:111:30
5: datafusion_common::scalar::ScalarValue::iter_to_null_array
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1509:13
6: datafusion_common::scalar::ScalarValue::iter_to_array
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1276:31
7: datafusion_common::scalar::ScalarValue::new_list
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1668:13
peekable::Peekable<I> as core::iter::traits::iterator::Iterator>::fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/peekable.rs:111:30
5: datafusion_common::scalar::ScalarValue::iter_to_null_array
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1509:13
6: datafusion_common::scalar::ScalarValue::iter_to_array
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1276:31
7: datafusion_common::scalar::ScalarValue::new_list
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/common/src/scalar.rs:1668:13
8: datafusion_sql::expr::value::<impl 8: datafusion_sql::expr::value::<impl datafusion_sql::planner::SqlToRel<S>>::sql_array_literal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/value.rs:162:23
datafusion_sql::planner::SqlToRel<S>>::sql_array_literal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/value.rs:162:23
9: datafusion_sql::expr::<impl datafusion_sql:: 9: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr_internal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:178:36
10: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:87:40
11: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::sql_fn_arg_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:217:17
planner::SqlToRel<S>>::sql_expr_to_logical_expr_internal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:178:36
10: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:87:40
11: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::sql_fn_arg_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:217:17
12: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel 12: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::function_args_to_expr::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:231:22
<S>>::function_args_to_expr::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:231:22
13: core::iter::adapters::map::map_try_fold::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:91:28
13: core::iter::adapters::map::map_try_fold::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:91:28
14: core::iter::traits::iterator::Iterator::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2461:21
14: core::iter::traits::iterator::Iterator::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2461:21
15: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:117:9
15: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:117:9
16: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:199:9
16: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:199:9
17: core::iter::traits::iterator::Iterator::try_for_each
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2523:9
17: core::iter::traits::iterator::Iterator::try_for_each
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2523:9
18: <core::iter::adapters:: 18: <core::iter::adapters::GenericShunt<I,R> as coreGenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:182:14
::iter::traits::iterator::Iterator>::next
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:182:14
19: <alloc::vec::Vec<T> as alloc 19: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter_nested.rs:26:32
::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter_nested.rs:26:32
20: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc:: 20: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/in_place_collect.rs:167:20
21: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/mod.rs:2749:9
vec::Vec<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/in_place_collect.rs:167:20
21: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/mod.rs:2749:9
22: core::iter::traits::iterator::Iterator::collect
22: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
23: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:51
24: core::iter::adapters::try_process
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:168:17
25: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:9
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
23: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:51
24: core::iter::adapters::try_process
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:168:17
25: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:9
26: core::iter::traits::iterator::Iterator::collect
at 26: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
27: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::function_args_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:230:9
28: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel/rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
27: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::function_args_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:230:9
28: datafusion_sql::expr::function::<impl datafusion_sql::planner::SqlToRel<S>>::sql_function_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:74:24
29: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr_internal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:433:17
30: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:87:40
31: datafusion_sql::expr<S>>::sql_function_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/function.rs:74:24
29: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr_internal
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:433:17
30: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_expr_to_logical_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:87:40
31: datafusion_sql::expr::<impl datafusion_sql::planner::SqlToRel<S>>::sql_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:121:24
32: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::sql_select_to_rex
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:360:28
::<impl datafusion_sql::planner::SqlToRel<S>>::sql_to_expr
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/expr/mod.rs:121:24
32: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::sql_select_to_rex
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:360:28
33: datafusion_sql::select::<impl datafusion_sql::planner 33: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::prepare_select_exprs::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:342:25
34: core::iter::adapters::map::map_try_fold::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:91:28
::SqlToRel<S>>::prepare_select_exprs::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:342:25
34: core::iter::adapters::map::map_try_fold::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:91:28
35: core::iter::traits::iterator::Iterator::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2461:21
35: core::iter::traits::iterator::Iterator::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2461:21
36: <core::iter::adapters::map::Map 36: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:117:9
<I,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:117:9
37: 37: <core::iter::adapters<core::iter::adapters::map::Map<::map::Map<I,F>I,F> as core:: as core::iter::traits::iteratoriter::traits::iterator::Iterator>::try_fold::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/map.rs:117:9
:117:9
38: <core::iter::adapters::fuse::Fuse< 38: <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/fuse.rs:368:19
I> as core::iter::adapters::fuse::FuseImpl<I>>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/fuse.rs:368:19
39: <core::iter::adapters::fuse::Fuse<I> as core::iter::traits 39: <core::iter::adapters::fuse::Fuse<I> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/fuse.rs:82:9
40: core::iter::adapters::flatten::FlattenCompat<I,U>::iter_try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:386:25
::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/fuse.rs:82:9
40: core::iter::adapters::flatten::FlattenCompat<I,U>::iter_try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:386:25
41: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:523 41: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:523:9
42: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:67:9
43: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:199:9
44: core::iter:::9
42: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/flatten.rs:67:9
43: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:199:9
44: core::iter::traits::iterator::Iterator::try_for_each
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2523:9
45: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:182:14
traits::iterator::Iterator::try_for_each
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2523:9
45: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:182:14
46: <alloc::vec::Vec<T> 46: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter_nested.rs:26:32
as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter_nested.rs:26:32
47: <alloc::vec::Vec<T> as 47: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter.rs:33:9
48: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/mod.rs:2749:9
49: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
50: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:51
51: core::iter::adapters::try_process
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:168:17
52: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:9
53: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
54: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::prepare_select_exprs
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:340:9
55: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::select_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:86:28
56: datafusion_sql::set_expr::<impl datafusion_sql::planner::SqlToRel<S>>::set_expr_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/set_expr.rs:30:35
57: datafusion_sql::query::<impl datafusion_sql::planner::SqlToRel<S>>::query_to_plan_with_schema
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/query.rs:80:20
58: datafusion_sql::query::<impl datafusion_sql::planner::SqlToRel<S>>::query_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/query.rs:41:9
59: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan_with_context_impl
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:183:40
60: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:151:9
61: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::statement_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:138:42
alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/spec_from_iter.rs:33:9
48: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/alloc/src/vec/mod.rs:2749:9
49: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
50: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:51
51: core::iter::adapters::try_process
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/adapters/mod.rs:168:17
52: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/result.rs:1933:9
53: core::iter::traits::iterator::Iterator::collect
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/iter/traits/iterator.rs:2053:9
54: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::prepare_select_exprs
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:340:9
55: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::select_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/select.rs:86:28
56: datafusion_sql::set_expr::<impl datafusion_sql::planner::SqlToRel<S>>::set_expr_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/set_expr.rs:30:35
57: datafusion_sql::query::<impl datafusion_sql::planner::SqlToRel<S>>::query_to_plan_with_schema
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/query.rs:80:20
58: datafusion_sql::query::<impl datafusion_sql::planner::SqlToRel<S>>::query_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/query.rs:41:9
59: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan_with_context_impl
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:183:40
60: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:151:9
61: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::statement_to_plan
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/sql/src/statement.rs:138:42
62: datafusion::execution::context::SessionState::statement_to_plan::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:1676:9
62: datafusion::execution::context::SessionState::statement_to_plan::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:1676:9
63: datafusion::execution::context::SessionState::create_logical_plan::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:1691:54
63: datafusion::execution::context::SessionState::create_logical_plan::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:1691:54
64: datafusion::execution::context::SessionContext::sql_with_options::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:459:58
64: datafusion::execution::context::SessionContext::sql_with_options::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:459:58
65: datafusion::execution::context::SessionContext::sql::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:425:55
65: datafusion::execution::context::SessionContext::sql::{{closure}}
at /Users/edmondoporcu/Development/open-source/arrow-datafusion/datafusion/core/src/execution/context/mod.rs:425:55
66: datafusion_sqllogictest::engines::datafusion_engine::runner::run_query::{{closure} 66: datafusion_sqllogictest::engines::datafusion_engine::runner::run_query::{{closure}}
at ./src/engines/datafusion_engine/runner.rs:71:43
67: <datafusion_sqllogictest::engines::datafusion_engine::runner::DataFusion as sqllogictest::runner::AsyncDB>::run::{{closure}}
at ./src/engines/datafusion_engine/runner.rs:52:35
}
at ./src/engines/datafusion_engine/runner.rs:71:43
67: <datafusion_sqllogictest::engines::datafusion_engine::runner::DataFusion as sqllogictest::runner::AsyncDB>::run::{{closure}}
at ./src/engines/datafusion_engine/runner.rs:52:35
68: <core::pin::Pin<P> as core::future:: 68: <core::pin::Pin<P> as core::future::future::Future>::poll
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/future/future.rs:125:9
future::Future>::poll
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/future/future.rs:125:9
69: sqllogictest::runner::Runner<D,M>:: 69: sqllogictest::runner::Runner<D,M>::apply_record::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqllogictest-0.17.1/src/runner.rs:670:62
apply_record::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqllogictest-0.17.1/src/runner.rs:670:62
70: sqllogictest::runner::Runner<D,M> 70: sqllogictest::runner::Runner<D,M>::update_test_file::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqllogictest-0.17.1/src/runner.rs:1201:75
::update_test_file::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqllogictest-0.17.1/src/runner.rs:1201:75
71: sqllogictests::run_complete_file::{{closure}}
at 71: sqllogictests::run_complete_file::{{closure}}
at ./bin/sqllogictests.rs:205:10
./bin/sqllogictests.rs:205:10
72: sqllogictests::run_tests::{{closure}}::{{closure}}::{{closure} 72: sqllogictests::run_tests::{{closure}}::{{closure}}::{{closure}}
at ./bin/sqllogictests.rs:92:50
}
at ./bin/sqllogictests.rs:92:50
73: <core::pin::Pin<P> as 73: <core::pin::Pin<P> as core::future::future::Future>::poll
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/future/future.rs:125:9
core::future::future::Future>::poll
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/future/future.rs:125:9
74: tokio::runtime::task::core::Core<T, 74: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/core.rs:223:17
S>::poll::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/core.rs:223:17
75: tokio::loom::std::unsafe_cell::UnsafeCell< 75: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/loom/std/unsafe_cell.rs:14:9
76: tokio::runtime::task::core::Core<T,S>::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/core.rs:212:13
T>::with_mut
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/loom/std/unsafe_cell.rs:14:9
76: tokio::runtime::task::core::Core<T,S>::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/core.rs:212:13
77: tokio::runtime::task::harness::poll_future::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:476:19
77: tokio::runtime::task::harness::poll_future::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:476:19
78: <core::panic::unwind_safe::AssertUnwindSafe<F> as 78: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panic/unwind_safe.rs:271:9
core::ops::function::FnOnce<()>>::call_once
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/core/src/panic/unwind_safe.rs:271:9
79: 79: std::panicking::try::do_call
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs:526:40
std::panicking::try::do_call
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs:526:40
80: ___rust_try
80: ___rust_try
81: std::panicking::try
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs 81: std::panicking::try
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panicking.rs:490:19
:490:19
82: std::panic::catch_unwind
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panic.rs:142 82: std::panic::catch_unwind
at /rustc/203c57dbe20aee67eaa8f7be45d1e4ef0b274109/library/std/src/panic.rs:142:14
83: tokio::runtime::task::harness::poll_future
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:464:18
:14
83: tokio::runtime::task::harness::poll_future
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:464:18
84: 84: tokio::runtime::task::harness::Harness<T,S>::poll_inner
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:198:27
tokio::runtime::task::harness::Harness<T,S>::poll_inner
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:198:27
85: tokio::runtime::task::harness::Harness< 85: tokio::runtime::task::harness::Harness<T,S>::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:152:15
T,S>::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/harness.rs:152:15
86: tokio::runtime::task::raw::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/raw.rs:255:5
86: tokio::runtime::task::raw::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/raw.rs:255:5
87: tokio::runtime::task:: 87: tokio::runtime::task::raw::RawTask::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/raw.rs:200:18
raw::RawTask::poll
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/raw.rs:200:18
88: tokio::runtime::task::LocalNotified<S>::run
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/mod.rs:394:9
88: tokio::runtime::task::LocalNotified<S>::run
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/task/mod.rs:394:9
89: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:487:21
90: tokio::runtime::coop::with_budget
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/coop.rs:107:5
91: tokio 89: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:487:21
90: tokio::runtime::coop::with_budget
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/coop.rs:107:5
91: tokio::runtime::coop::budget
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/coop.rs:73:5::runtime::coop::budget
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/coop.rs:73:5
92: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
92: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:463:9
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:463:9
93 93: tokio::runtime::scheduler::multi_thread::worker::: tokio::runtime::scheduler::multi_thread::worker::Context::run
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:426:24Context::run
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:426:24
94: tokio::runtime::scheduler::multi_thread 94: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:406:17
::worker::run::{{closure}}
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/runtime/scheduler/multi_thread/worker.rs:406:17
95: tokio::macros::scoped_tls::ScopedKey<T>::set
at /Users/edmondoporcu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.1/src/macros/scoped_tls.rs: 95: tokio::macros::scoped_tls::ScopedKey<T>::set

@jayzhan211

Copy link
Copy Markdown
Contributor

select array_union([[]], []);

array union should have the same data type which including the dimension of array. Union with 2d and 1d is not allowed


# array_union scalar function #6
query ?
select array_union([], []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked in spark

scala> spark.sql("select array_union(array(), array())").show(false)
+-----------------------------+ |array_union(array(), array())|
+-----------------------------+
|[] |
+-----------------------------+

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even surprised my code work here tbh, do I need to add an additional branch to pattern matching where both array have null data type and return an empty array?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even surprised my code work here tbh, do I need to add an additional branch to pattern matching where both array have null data type and return an empty array?

I prefer return empty array in this case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even surprised my code work here tbh, do I need to add an additional branch to pattern matching where both array have null data type and return an empty array?

I don't think you should check the input types (they should still be lists, they'll just have an offset buffer of [0, 1]

Maybe you just need to handle the case specially in array_union


# array_union scalar function #10
query ?
select array_union(null, null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scala> spark.sql("select array_union(array(null), array(null))").show(false)
+-------------------------------------+
|array_union(array(NULL), array(NULL))|
+-------------------------------------+
|[NULL] |
+-------------------------------------+

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more interesting, because I am not sure null has offsets in the ListArray, I suppose my code just get into the union function, but it exits immediately with empty results, because the offsets are empty...How would you go about it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scala> spark.sql("select array_union(array(null), array(null))").show(false)
+-------------------------------------+
|array_union(array(NULL), array(NULL))|
+-------------------------------------+
|[NULL] |
+-------------------------------------+

array(null) is not the same as null.

array(null) is like array_union scalar function #8

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add an extra branch in my match case like so:

(DataType::Null,DataType::Null) => {let data = ArrayData::new_empty(&DataType::Null);Ok(Arc::new(FixedSizeListArray::from(data)))}

but that also produce a NULL response rather than an empty arary, do you have any guidance @comphead ? It's unclear to me how to get an [] and also a [NULL]

[hello, datafusion]



Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove empty lines

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @edmondop -- this is a really nice (first 🤯 ) contribution and a great example of a team effort.

I suggest we merge this PR as is, and file a ticket to fix the null handling as a follow on PR. My rationale is that this is a new function, so it isn't introducing a regression and we can iteratively improve it over time

let r_values = converter.convert_columns(&[r_values])?;

// Might be worth adding an upstream OffsetBufferBuilder
let mut offsets = Vec::<OffsetSize>::with_capacity(l.len() + 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really neat implementation @edmondop.


# array_union scalar function #6
query ?
select array_union([], []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even surprised my code work here tbh, do I need to add an additional branch to pattern matching where both array have null data type and return an empty array?

I don't think you should check the input types (they should still be lists, they'll just have an offset buffer of [0, 1]

Maybe you just need to handle the case specially in array_union

@alambalamb changed the title Array_union implementationImplement array_unionNov 13, 2023
@alamb
alamb merged commit cbb2fd7 into apache:mainNov 13, 2023
@alamb

Copy link
Copy Markdown
Contributor

Thanks again everyone who contributed to this PR

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-exprLogical plan and expressionsphysical-exprChanges to the physical-expr cratessqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement array_union function

5 participants

@edmondop@comphead@jayzhan211@alamb@Weijun-H