Timestamp Addition Inconsistencies
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 1.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 195
Description
There are two ways of calling performing timestamp addition in pinot:
1. `TIMESTAMPADD`
2. `DATEADD`
The former is parsed directly by Calcite while the latter is passed into the Pinot engine. This leads to a few issues:
1. `TIMESTAMPADD` expects a time interval literal while `DATEADD` expects a string as the first argument. This means that `TIMESTAMPADD('DAY', ...)` is invalid and should be `TIMESTAMPADD(DAY, ...` while `DATEADD(DAY, ...)` is invalid and should be `DATEADD('DAY', ...`
2. Calcite parses the first argument as a `TimestampInterval()`, which does not include some units that are supported in `DATEADD` (such as, notably, `MILLISECOND`) which means that `TIMESTAMPADD(MILLISECOND` fails to parse while `DATEADD('MILLISECOND'` succeeds
Contributor guide
Research direction
Start by tracing how TIMESTAMPADD is parsed by Calcite and how DATEADD is handled in the Pinot engine. Compare their argument formats and supported time units, especially MILLISECOND; done means the two timestamp-addition functions have consistent, documented parsing and unit behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100