Skip to content

Conversation

@jayzhan211
Copy link
Contributor

Which issue does this PR close?

Closes #6979

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) labels Nov 11, 2023
parse_expr(&args[0], registry)?,
parse_expr(&args[1], registry)?,
)),
ScalarFunction::ArrayIntersect => Ok(array_intersect(
Copy link
Contributor Author

@jayzhan211 jayzhan211 Nov 11, 2023

Choose a reason for hiding this comment

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

Missing from #8081. Not sure why CI from #8081 does not catch this

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to enhance the check during CI? maybe this is a little bug?


## array_except

statement ok
Copy link
Contributor Author

@jayzhan211 jayzhan211 Nov 11, 2023

Choose a reason for hiding this comment

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

Unlike other tests, I try a new style of test, keep creating table and drop table close together, hope this is easier for review.

Copy link
Contributor

Choose a reason for hiding this comment

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

this is choice of style, imho no-table tests are easier to read.

query ?
select array_expect([], []), array_except(....)
----
[], ...

Copy link
Contributor Author

@jayzhan211 jayzhan211 Nov 13, 2023

Choose a reason for hiding this comment

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

Well, we still need table to test multi-rows cases. The new style I mean is not create table in the beginning of this large file and drop table at the end of the file, but when we are done we drop it.

Copy link
Contributor

Choose a reason for hiding this comment

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

the multirow still possible to do without creating a table

select ... from (select 1 a, 'asdf' b union all select 2 b, 'zxcv' b)

thats the matter of style of course.

Copy link
Contributor Author

@jayzhan211 jayzhan211 Nov 14, 2023

Choose a reason for hiding this comment

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

We cant differentiate empty array and null currently. Both of them are null type So we can fix them in another PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I also prefer the new style (create/query/drop table statements are organized more tightly). This will make tests more clear.

@jayzhan211 jayzhan211 marked this pull request as ready for review November 11, 2023 06:05
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

Thanks @jayzhan211 please also add tests with empty arrays

And since we have introduced the new built in function we need to get it documented in
scalar_functions.md and expressions.md

@jayzhan211 jayzhan211 marked this pull request as draft November 13, 2023 23:33
@jayzhan211 jayzhan211 marked this pull request as ready for review November 14, 2023 01:31
@Veeupup
Copy link
Contributor

Veeupup commented Nov 14, 2023

LGTM!

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @jayzhan211
Please create a followup ticket to differentiate empty array and null, that sounds important

@alamb
Copy link
Contributor

alamb commented Nov 14, 2023

There appears to be a non trivial number of conflicts in this PR now

Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
@alamb
Copy link
Contributor

alamb commented Nov 17, 2023

I took the liberty of merging up from main to resolve a merge conflict

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

Labels

logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement array_except function

4 participants