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.
Merge #1
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
Uh oh!
There was an error while loading. Please reload this page.
Merge #1
Changes from 1 commit
27d0c3f42050c34080c4b8c8016aabc88de4a89fa1c764dd6ff3a737252b6cfa9ae262f7cc695076186e93ac4e181b6f113e26492c7c6b643be574189bad26e2c4787051e691a838dbdfe4bee876bc9db51d35097a2ea58f725d47655356ec08bc37d22768a0c40b94d50f6e6c38f4594513f1cda7e5c47c85968cb72b10b8b67ae81de9d37c02c14fff2e84b3e9be4d75588ce650f8feef3abbd8b0914a36a72358989cde07cbbea1b90bf21db2f86a4235ab8b59d6c8159c766c9dc3a1213d58beb736d3679a9103de969f3c821bdc4943cd04607570525fada3ad3aed7ff3bd28e8e4dd0066cc852d44bffcf5fda0e6e420abb4233c214d72f398ece421394946e42409320816771467d5b9b31700111d4b2f0df286713ea9d68dd92e15989b0c728b8383101839039eb79a76791b8e1ea806a0b3d7ad841b33bd031c20cf2f48a4601cb0cd436be1388012ec3265c6938ea3b1674cf2ead4d85dafab9a84fae730a17851d6ba7e44d191178a1f340485f4ee66890858bf762bc3fff7aca0dd854a0f74e0e4e56b5e0e26f68769aedf0908fabbab0f48aaf8b71e5491747bd93289b5275e044eecef7520ee2f5130e9ae228b1eadf22535855671080afc797c5db4577510c65a512e8932e26118b7ad2ea8b5dfbd213a02399134b103449f0534fb64fe82bd2f21b056a3bebcb501777d80aa5ffddfc8948a6e8ef1e8494e6d31fde360e90da667db3eba2969b0cc12d871adee83d09a927f1ac97b3edba4d413fa95a5c3b0bca44d93fb7cc7493f7ba16ff6edabebe9461042b3c3796390f02beb8d2f8136295aa1acfe3a7126c8b62399f302c2ee94abd7b5b1b69782a94dd193248abba53e9e12c94148cd26ef8152567e1360ef6dce2da576a7cfcaf52ba0456281915dae696c3652186afa42d894bfa09cfff9fcd51f1443e9407fba857f109a988aaf89159669ac4b2d2e28622322ec0b4ecbdbb39d53d302c5b4f95de93b51f10ede00344e93e71e657edb42eb8c4209dacdd35a482e7d11cbf26d4cc7b8eb8f74fda4070239ee3f4b902d3dc0bc7af800fa32f0a38c100fc5878bdcfa00347a3901ff928616109ec5d69878b0cbeef4c29856926806f8c001dba673f743514639af51dc3a0d0277fe8a89e42c529a3dcca23f45f14cfce3ee4b4a352437878ab92e174a6005c0f65b49f4d5aa45b4d917e99a9f75fc363b31a5dea6ffec5eeef11babb4400cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
intervalpr……efix ### What changes were proposed in this pull request? In the PR, I propose to move interval parsing to `CalendarInterval.fromCaseInsensitiveString()` which throws an `IllegalArgumentException` for invalid strings, and reuse it from `CalendarInterval.fromString()`. The former one handles `IllegalArgumentException` only and returns `NULL` for invalid interval strings. This will allow to support interval strings without the `interval` prefix in casting strings to intervals and in interval type constructor because they use `fromString()` for parsing string intervals. For example: ```sql spark-sql> select cast('1 year 10 days' as interval); interval 1 years 1 weeks 3 days spark-sql> SELECT INTERVAL '1 YEAR 10 DAYS'; interval 1 years 1 weeks 3 days ``` ### Why are the changes needed? To maintain feature parity with PostgreSQL which supports interval strings without prefix: ```sql # select interval '2 months 1 microsecond'; interval ------------------------ 2 mons 00:00:00.000001 ``` and to improve Spark SQL UX. ### Does this PR introduce any user-facing change? Yes, previously parsing of interval strings without `interval` gives `NULL`: ```sql spark-sql> select interval '2 months 1 microsecond'; NULL ``` After: ```sql spark-sql> select interval '2 months 1 microsecond'; interval 2 months 1 microseconds ``` ### How was this patch tested? - Added new tests to `CalendarIntervalSuite.java` - A test for casting strings to intervals in `CastSuite` - Test for interval type constructor from strings in `ExpressionParserSuite` Closes apache#26079 from MaxGekk/interval-str-without-prefix. Authored-by: Maxim Gekk <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing