-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17018][SQL] literals.sql for testing literal parsing #14598
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
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
15d2eec
[SPARK-17018][SQL] literals.sql for testing literal parsing
petermaxlee c40c957
Add more floating point literals
petermaxlee 243cd39
remove spaces
petermaxlee d60b2bb
Large decimals
petermaxlee 3f0b006
Merge branch 'master' into SPARK-17018-2
petermaxlee 00bc63a
Add more literals
petermaxlee bd72b4e
remove \b
petermaxlee 5565144
Remove \0
petermaxlee 457d8da
Fix typo
petermaxlee 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 |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| -- Literal parsing | ||
|
|
||
| -- null | ||
| select null, Null, nUll; | ||
|
|
||
| -- boolean | ||
| select true, tRue, false, fALse; | ||
|
|
||
| -- byte (tinyint) | ||
| select 1Y; | ||
| select 127Y, -128Y; | ||
|
|
||
| -- out of range byte | ||
| select 128Y; | ||
|
|
||
| -- short (smallint) | ||
| select 1S; | ||
| select 32767S, -32768S; | ||
|
|
||
| -- out of range short | ||
| select 32768S; | ||
|
|
||
| -- long (bigint) | ||
| select 1L, 2147483648L; | ||
| select 9223372036854775807L, -9223372036854775808L; | ||
|
|
||
| -- out of range long | ||
| select 9223372036854775808L; | ||
|
|
||
| -- integral parsing | ||
|
|
||
| -- parse int | ||
| select 1, -1; | ||
|
|
||
| -- parse int max and min value as int | ||
| select 2147483647, -2147483648; | ||
|
|
||
| -- parse long max and min value as long | ||
| select 9223372036854775807, -9223372036854775808; | ||
|
|
||
| -- parse as decimals (Long.MaxValue + 1, and Long.MinValue - 1) | ||
| select 9223372036854775808, -9223372036854775809; | ||
|
|
||
| -- out of range decimal numbers | ||
| select 1234567890123456789012345678901234567890; | ||
| select 1234567890123456789012345678901234567890.0; | ||
|
|
||
| -- double | ||
| select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5, .9e+2, 0.9e+2, 900e-1, 9.e+1; | ||
| select -1D, -1.2D, -1e10, -1.5e5, -.10D, -0.10D, -.1e5; | ||
| -- negative double | ||
| select .e3; | ||
| -- inf and -inf | ||
| select 1E309, -1E309; | ||
|
|
||
| -- decimal parsing | ||
| select 0.3, -0.8, .5, -.18, 0.1111, .1111; | ||
|
|
||
| -- super large scientific notation numbers should still be valid doubles | ||
| select 123456789012345678901234567890123456789e10, 123456789012345678901234567890123456789.1e10; | ||
|
|
||
| -- string | ||
| select "Hello Peter!", 'hello lee!'; | ||
| -- multi string | ||
| select 'hello' 'world', 'hello' " " 'lee'; | ||
| -- single quote within double quotes | ||
| select "hello 'peter'"; | ||
| select 'pattern%', 'no-pattern\%', 'pattern\\%', 'pattern\\\%'; | ||
| select '\'', '"', '\n', '\r', '\t', 'Z'; | ||
| -- "Hello!" in octals | ||
| select '\110\145\154\154\157\041'; | ||
| -- "World :)" in unicode | ||
| select '\u0057\u006F\u0072\u006C\u0064\u0020\u003A\u0029'; | ||
|
|
||
| -- date | ||
| select dAte '2016-03-12'; | ||
| -- invalid date | ||
| select date 'mar 11 2016'; | ||
|
|
||
| -- timestamp | ||
| select tImEstAmp '2016-03-11 20:54:00.000'; | ||
| -- invalid timestamp | ||
| select timestamp '2016-33-11 20:54:00.000'; | ||
|
|
||
| -- interval | ||
| select interval 13.123456789 seconds, interval -13.123456789 second; | ||
| select interval 1 year 2 month 3 week 4 day 5 hour 6 minute 7 seconds 8 millisecond, 9 microsecond; | ||
| -- ns is not supported | ||
| select interval 10 nanoseconds; | ||
|
|
||
| -- unsupported data type | ||
| select GEO '(10,-6)'; | ||
16 changes: 0 additions & 16 deletions
16
sql/core/src/test/resources/sql-tests/inputs/number-format.sql
This file was deleted.
Oops, something went wrong.
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.
Shouldn't we also add really large double,
1E309for instance (that will actually evaluate to positive infinity).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.
Let me add that.