Skip to content

Conversation

@morrySnow
Copy link
Contributor

pick from master #35863

if date arithmetic (date_add / date_sub)'s first argument is StringLikeLiteral. We use date signature as far as possible.

for example:

SQL: select date_sub('2024-05-28', INTERVAL 1 week);

before this PR:

+------------------------------------------------+
| weeks_sub(cast('2024-05-28' as DATETIMEV2), 1) |
+------------------------------------------------+
| 2024-05-21 00:00:00                            |
+------------------------------------------------+

after this PR:

+--------------------------------------------+
| weeks_sub(cast('2024-05-28' as DATEV2), 1) |
+--------------------------------------------+
| 2024-05-21                                 |
+--------------------------------------------+

Proposed changes

Issue Number: close #xxx

pick from master #35863

if date arithmetic (date_add / date_sub)'s first argument is
StringLikeLiteral. We use date signature as far as possible.

for example:

SQL: `select date_sub('2024-05-28', INTERVAL 1 week);`

before this PR:
```
+------------------------------------------------+
| weeks_sub(cast('2024-05-28' as DATETIMEV2), 1) |
+------------------------------------------------+
| 2024-05-21 00:00:00                            |
+------------------------------------------------+
```

after this PR:
```
+--------------------------------------------+
| weeks_sub(cast('2024-05-28' as DATEV2), 1) |
+--------------------------------------------+
| 2024-05-21                                 |
+--------------------------------------------+
```
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@morrySnow
Copy link
Contributor Author

run buildall

@morningman morningman merged commit 075481f into branch-2.1 Jun 8, 2024
@morrySnow morrySnow deleted the 2.1_35863 branch September 2, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants