-
Notifications
You must be signed in to change notification settings - Fork 342
feat: support multiply_ym_interval with YearMonth interval codegen dispatch #4715
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
Open
peterxcli
wants to merge
19
commits into
apache:main
Choose a base branch
from
peterxcli:feat/make_ym_interval
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3c37026
Support multiply_ym_interval with YearMonth interval codegen dispatch
peterxcli b96f547
Fix markdown formatting for interval docs
peterxcli 30e04f3
Merge branch 'main' into feat/make_ym_interval
peterxcli 01f0463
Fix markdown formatting for interval docs
peterxcli 645a58d
Merge branch 'main' of https://github.com/apache/datafusion-comet int…
peterxcli 1641d57
review by andy
peterxcli 49d882a
fix md format
peterxcli 018efc1
restructure the CometLiteral.getSupportLevel
peterxcli a6aeb3a
Merge branch 'main' into feat/make_ym_interval
peterxcli e9ffc6f
Merge branch 'main' into feat/make_ym_interval
peterxcli a9bc017
Update datatypes.md
peterxcli 783e5ec
review suggestion
peterxcli 3c9867d
fix style
peterxcli 582f211
Merge branch 'main' into feat/make_ym_interval
peterxcli f7cd0d0
Merge branch 'main' into feat/make_ym_interval
peterxcli 1e96eeb
Merge branch 'main' of https://github.com/apache/datafusion-comet int…
peterxcli 90e5ddd
minor change
peterxcli c540044
md prettier
peterxcli b6013da
Use DataTypeSupport for sink type checks
peterxcli 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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
spark/src/test/resources/sql-tests/expressions/datetime/multiply_ym_interval.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,64 @@ | ||
| -- 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. | ||
|
|
||
| -- Routes multiply_ym_interval through the codegen dispatcher; produces YearMonthIntervalType. | ||
| -- Config: spark.comet.exec.scalaUDF.codegen.enabled=true | ||
|
|
||
| statement | ||
| CREATE TABLE test_multiply_ym_interval(y int, m int, i int, l long, f float, d double, dec decimal(10,2)) USING parquet | ||
|
|
||
| statement | ||
| INSERT INTO test_multiply_ym_interval VALUES | ||
| (1, 2, 2, CAST(3 AS BIGINT), CAST(1.5 AS FLOAT), CAST(2.5 AS DOUBLE), CAST(2.50 AS DECIMAL(10, 2))), | ||
| (-1, 1, -2, CAST(-3 AS BIGINT), CAST(-1.5 AS FLOAT), CAST(-2.5 AS DOUBLE), CAST(-2.50 AS DECIMAL(10, 2))), | ||
| (0, 6, 0, CAST(0 AS BIGINT), CAST(0.5 AS FLOAT), CAST(0.5 AS DOUBLE), CAST(0.50 AS DECIMAL(10, 2))), | ||
| (2, -6, NULL, NULL, NULL, NULL, NULL) | ||
|
|
||
| query | ||
| SELECT | ||
| make_ym_interval(y, m) * i, | ||
| make_ym_interval(y, m) * l, | ||
| make_ym_interval(y, m) * f, | ||
| make_ym_interval(y, m) * d, | ||
| make_ym_interval(y, m) * dec | ||
| FROM test_multiply_ym_interval | ||
|
|
||
| -- literal interval input | ||
| query | ||
| SELECT INTERVAL '1-2' YEAR TO MONTH * i FROM test_multiply_ym_interval | ||
|
|
||
| -- numeric on the left is normalized by Spark to multiply_ym_interval. | ||
| query | ||
| SELECT i * make_ym_interval(y, m), 2 * INTERVAL '1-2' YEAR TO MONTH | ||
| FROM test_multiply_ym_interval | ||
|
|
||
| -- literal multipliers, including half-up rounding for fractional months. | ||
| query | ||
| SELECT | ||
| make_ym_interval(1, 2) * 2, | ||
| make_ym_interval(1, 2) * 1.5D, | ||
| make_ym_interval(1, 2) * CAST(1.50 AS DECIMAL(10, 2)), | ||
| make_ym_interval(-1, 1) * 1.5D | ||
|
|
||
| -- null interval input | ||
| query | ||
| SELECT make_ym_interval(NULL, m) * 2 FROM test_multiply_ym_interval | ||
|
|
||
| -- 178956970 years and 7 months is Int.MaxValue months. Multiplication overflows regardless of | ||
| -- ANSI mode; the lowercase pattern matches Spark 3.x and 4.x error messages. | ||
| query expect_error(overflow) | ||
| SELECT make_ym_interval(178956970, 7) * 2 |
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.
Moved
CalendarIntervalTypeunderCometLiteral#getSupportLevel