apache / apache/paimon

[Bug] Spark use `>` or `<` determining the timestamp type field, the result is not as expected

Open
#2,325 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/incubator-paimon/issues) and found nothing similar.

### Paimon version

paimon 0.5

### Compute Engine

spark 3.3

### Minimal reproduce step

1. cdc accesses a table in which the primary key is two fields, one is of int type and the other is of datatime type.
2. Use two different statements in spark
`select count(*) from *** where collect_time < '2023-11-14 00:00:00' and collect_time >= '2023-11-13 00:00:00';`
result : 1151980
`select count(*) from *** where date(collect_time) ='2023-11-13';`
result: 1270271

### What doesn't meet your expectations?

I think the results should be the same twice. I also ran these two statements in trino and the results were the same.

### Anything else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the discrepancy with Paimon 0.5 and Spark 3.3 using a CDC table whose primary key contains an int and a datetime field. Compare the two count queries and inspect the Spark-facing timestamp predicate and type-handling entry points; done means the range and date predicates return equivalent results, with a regression test covering the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
spark
Domain
data
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.