-
Notifications
You must be signed in to change notification settings - Fork 299
feat: support spark bin function #3928
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
768b3e9
impl map_from_entries
c68c342
Revert "impl map_from_entries"
d887555
Merge branch 'apache:main' into main
kazantsev-maksim 231aa90
Merge branch 'apache:main' into main
kazantsev-maksim 9500bbb
Merge branch 'apache:main' into main
kazantsev-maksim 9577481
Merge branch 'apache:main' into main
kazantsev-maksim 3791557
Merge branch 'apache:main' into main
kazantsev-maksim 7c2f082
Merge branch 'apache:main' into main
kazantsev-maksim 609a605
Merge branch 'apache:main' into main
kazantsev-maksim a151b2c
Merge branch 'apache:main' into main
kazantsev-maksim ad3e7f5
Merge branch 'apache:main' into main
kazantsev-maksim ea92e4b
Merge branch 'apache:main' into main
kazantsev-maksim 8dfeca3
Merge branch 'apache:main' into main
kazantsev-maksim 559741e
Merge branch 'apache:main' into main
kazantsev-maksim ebda14e
Merge branch 'apache:main' into main
kazantsev-maksim 408152e
Merge branch 'apache:main' into main
kazantsev-maksim d7857b2
Merge branch 'apache:main' into main
kazantsev-maksim aef41be
Merge branch 'apache:main' into main
kazantsev-maksim 5ac1c58
Merge branch 'apache:main' into main
kazantsev-maksim 9ae8e23
Merge branch 'apache:main' into main
kazantsev-maksim 5ca3888
Merge branch 'apache:main' into main
kazantsev-maksim 160a817
Merge branch 'apache:main' into main
kazantsev-maksim 88fc313
Merge branch 'apache:main' into main
kazantsev-maksim e14c180
Merge branch 'apache:main' into main
kazantsev-maksim 610a885
Merge branch 'apache:main' into main
kazantsev-maksim f8acb2c
Merge branch 'apache:main' into main
kazantsev-maksim ec94897
Merge branch 'apache:main' into main
kazantsev-maksim 43405e4
Merge branch 'apache:main' into main
kazantsev-maksim 47b4915
Merge branch 'apache:main' into main
kazantsev-maksim 26e2682
Merge branch 'apache:main' into main
kazantsev-maksim 6cb5f07
Merge branch 'apache:main' into main
kazantsev-maksim ec194fb
Merge branch 'apache:main' into main
kazantsev-maksim 256fccb
Merge branch 'apache:main' into main
kazantsev-maksim 912c8f9
Merge branch 'apache:main' into main
kazantsev-maksim 561a664
Merge branch 'apache:main' into main
kazantsev-maksim a2099ab
Feat: support function bin
d926ef4
Merge branch 'apache:main' into main
kazantsev-maksim 130db0c
Merge remote-tracking branch 'origin/main' into spark_bin
f64c13a
Fix docs
d44185e
add more testcases
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,7 +296,7 @@ | |
| - [x] atan | ||
| - [x] atan2 | ||
| - [ ] atanh | ||
| - [ ] bin | ||
| - [x] bin | ||
| - [ ] bround | ||
| - [ ] cbrt | ||
| - [x] ceil | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
spark/src/test/resources/sql-tests/expressions/math/bin.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| -- Licensed to the Apache Software Foundation (ASF) under one | ||
| -- or more contributor license agreements. See the NOTICE file | ||
| -- distributed with this work for additional information | ||
| -- regarding copyright ownership. The ASF licenses this file | ||
| -- to you under the Apache License, Version 2.0 (the | ||
| -- "License"); you may not use this file except in compliance | ||
| -- with the License. You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, | ||
| -- software distributed under the License is distributed on an | ||
| -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| -- KIND, either express or implied. See the License for the | ||
| -- specific language governing permissions and limitations | ||
| -- under the License. | ||
|
|
||
| statement | ||
| CREATE TABLE test_bin(i int, l long, f float, d double) USING parquet | ||
|
|
||
| statement | ||
| INSERT INTO test_bin VALUES | ||
| (13, 1, 1.5, 1.5), | ||
| (1, 1, 0.1, 0.1), | ||
| (100, 100, 99.99, 99.99), | ||
| (255, 255, 255.255, 255.255), | ||
| (-13, -1, -1.5, -1.5), | ||
| (-1, -1, -0.1, -0.1), | ||
| (-100, -100, -99.99, -99.99), | ||
| (-255, -255, -255.255, -255.255), | ||
| (0, 0, 0.0, 0.0), | ||
| (0, 0, -0.0, -0.0), | ||
| (NULL, NULL, NULL, NULL), | ||
| (2147483647, 9223372036854775807, cast('Infinity' as float), cast('Infinity' as double)), | ||
| (-2147483648, -9223372036854775808, cast('-Infinity' as float), cast('-Infinity' as double)), | ||
| (100, 100, cast('Infinity' as float), cast('Infinity' as double)), | ||
| (200, 200, cast('-Infinity' as float), cast('-Infinity' as double)), | ||
| (300, 300, cast('NaN' as float), cast('NaN' as double)), | ||
| (5, 5, 1.401298464e-45, 4.9406564584124654e-324), | ||
| (1000, 1000, 3.402823466e+38, 1.7976931348623157e+308), | ||
| (7, 7, 0.1, 0.1), | ||
| (8, 8, 0.2, 0.2), | ||
| (9, 9, 0.3, 0.3), | ||
| (10, 10, 0.3333333333333333, 0.3333333333333333), | ||
| (500, 500, cast('NaN' as float), cast('Infinity' as double)), | ||
| (501, 501, cast('Infinity' as float), cast('NaN' as double)), | ||
| (502, 502, cast('-Infinity' as float), cast('NaN' as double)), | ||
| (503, 503, cast('NaN' as float), cast('-Infinity' as double)), | ||
| (123456789, 123456789, 123456.789, 123456789.123456789), | ||
| (-123456789, -123456789, -123456.789, -123456789.123456789), | ||
| (2147483646, 9223372036854775806, 999999.999, 999999999.999999999), | ||
| (-2147483647, -9223372036854775807, -999999.999, -999999999.999999999), | ||
| (999, NULL, NULL, 999.999), | ||
| (NULL, 888, 888.888, NULL), | ||
| (777, 777, NULL, 777.777), | ||
| (666, 666, 666.666, NULL), | ||
| (15, 15, 1.23456789, 1.2345678901234567), | ||
| (16, 16, -1.23456789, -1.2345678901234567), | ||
| (314, 314, 3.14159265, 3.14159265358979323846), | ||
| (271, 271, 2.71828183, 2.71828182845904523536); | ||
|
|
||
| query | ||
| SELECT bin(i), bin(l), bin(f), bin(d) FROM test_bin | ||
|
|
||
| -- literal arguments | ||
| query | ||
| SELECT bin(-5), bin(-1.5), bin(0), bin(NULL) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 @kazantsev-maksim when we talking to doubles please include also
-0, +0, +Inf, -InfNaNalready handled 👍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 @comphead, added more test cases