-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-21654][SQL] Complement SQL predicates expression description #18869
Changes from 2 commits
9895843
1369fd5
bca2b0b
b64c9e6
d8f1479
099c671
444c64d
ec9199a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,42 @@ | ||||||||||||||||||||||||
-- In | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we move these to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I feel the test coverage might be out of the scope of this PR a little bit. This PR is for the expression description. If you don't insist we add test here together, I'd like to submit other PR to improve the test coverage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do not have a test case, how can we know the description is correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me explain it a little bit more. No need to add more and more test cases in this PR. We need to ensure anything claimed in the descriptions is well tested; if no test case exists, we need to add it into this PR. It should include both negative and positive test cases. For example, map is not supported; and then this needs to be documented and tested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, the test cases should be added along with the codes which defines the semantics or the code changes such as #18818 that changes the underlying semantics. For example, I saw there are tests added to test map is not supported by #18818: Lines 112 to 122 in cba69ae
More tests are always good and not harm, I agreed. If the necessary tests are not added before, we should add and improve them. |
||||||||||||||||||||||||
select 1 in(1, 2, 3); | ||||||||||||||||||||||||
select 1 in(2, 3, 4); | ||||||||||||||||||||||||
select named_struct('a', 1, 'b', 2) in(named_struct('a', 1, 'b', 1), named_struct('a', 1, 'b', 3)); | ||||||||||||||||||||||||
select named_struct('a', 1, 'b', 2) in(named_struct('a', 1, 'b', 2), named_struct('a', 1, 'b', 3)); | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the existing test for |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
-- EqualTo | ||||||||||||||||||||||||
select 1 = 1; | ||||||||||||||||||||||||
select 1 = '1'; | ||||||||||||||||||||||||
select 1.0 = '1'; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
-- GreaterThan | ||||||||||||||||||||||||
select 1 > '1'; | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following test cases are intended to test the end-to-end comparison between different types. It doesn't make much sense to re-write them with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the test cases that trigger implicit type casting, we can keep them here. |
||||||||||||||||||||||||
select 2 > '1.0'; | ||||||||||||||||||||||||
select 2 > '2.0'; | ||||||||||||||||||||||||
select 2 > '2.2'; | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') > to_date('2009-07-30 04:17:52'); | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') > '2009-07-30 04:17:52'; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
-- GreaterThanOrEqual | ||||||||||||||||||||||||
select 1 >= '1'; | ||||||||||||||||||||||||
select 2 >= '1.0'; | ||||||||||||||||||||||||
select 2 >= '2.0'; | ||||||||||||||||||||||||
select 2.0 >= '2.2'; | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') >= to_date('2009-07-30 04:17:52'); | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') >= '2009-07-30 04:17:52'; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
-- LessThan | ||||||||||||||||||||||||
select 1 < '1'; | ||||||||||||||||||||||||
select 2 < '1.0'; | ||||||||||||||||||||||||
select 2 < '2.0'; | ||||||||||||||||||||||||
select 2.0 < '2.2'; | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') < to_date('2009-07-30 04:17:52'); | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') < '2009-07-30 04:17:52'; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
-- LessThanOrEqual | ||||||||||||||||||||||||
select 1 <= '1'; | ||||||||||||||||||||||||
select 2 <= '1.0'; | ||||||||||||||||||||||||
select 2 <= '2.0'; | ||||||||||||||||||||||||
select 2.0 <= '2.2'; | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') <= to_date('2009-07-30 04:17:52'); | ||||||||||||||||||||||||
select to_date('2009-07-30 04:17:52') <= '2009-07-30 04:17:52'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viirya, BTW, I think we could also do this as below:
Just double checked it renders fine in the doc as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fixed.