apache / apache/doris-spark-connector

[Bug] get query plan failed when where clause contains datetime/date type

Open
#291 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
107
Forks
126
Avg merge
3d 10h
Merged PRs (30d)
4

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.

### Version

25.0.1

### What's Wrong?

Get query plan failed when `where` clause contains datetime/date type because of incorrect sql.
origin sql:
`col("statisticsDate") >= date_sub(to_date(lit(DateUtils.getYesterday)), 30)`

exception:
![Image](https://github.com/user-attachments/assets/7b12dfe8-557b-4793-87ba-acfe945af32c)

### What You Expected?

generate the correct sql to get query plan when contains datetime/date type.

### How to Reproduce?

_No response_

### Anything Else?

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start with the SQL-generation path for the expression shown in issue #291 and inspect the reported exception for how datetime/date literals are rendered. Reproduce the query-plan request if possible, then verify that the generated SQL is valid and that a regression check covers the date_sub/to_date expression.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spark
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.