apache / apache/pinot

Support for more datetime SQL functions

Open
#9,207 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
189

Description

there are many ANSI SQL standard date time functions that we should support
`DateTimeFunction` already support many of these implementations but the semantics are different thus it is good to support the standardized ANSI function format:
- `{fn YEAR(date)}`, `{fn MONTH(date)}`, ...
- `DATE(string)`, Equivalent to `CAST(string AS DATE)`
- `{fn NOW()}`
- `TIMESTAMPADD(timeUnit, integer, datetime)`
- `TIMESTAMPDIFF(timeUnit, datetime, datetime2)`
- `TO_DATE(string, format)`
- `TO_TIMESTAMP(string, format)`
- `INTERVAL timeWithUnit [ TO timeWithUnit ]`

we might also consider supporting some other non SQL standard such as:
- `DATE_ADD(, )` or `DATEADD` in mysql/presto/sqlserver
- `TO_UNIXTIME` / `FROM_UNIXTIME`

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing DateTimeFunction implementation mentioned in the issue and compare its semantics with the listed ANSI SQL forms. Define the supported function scope and verify that the standardized forms, including DATE, NOW, TIMESTAMPADD, TIMESTAMPDIFF, TO_DATE, TO_TIMESTAMP, and INTERVAL, behave as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.