apache / apache/pinot

[Feature Request] Handling optional parts in date format

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

Description

Hello,

I think It could be a nice feature to handle optional parts in date format with `[]`
For example in my case, I can have DateTime with second fractions or not (it's adaptive).

Actually, I need to perform a `Substr` :

```
FromDateTime(Substr(JSONPATH(payload, '$.created_at'), 0, 18), 'yyyy-MM-dd''T''HH:mm:ss')
```

But It could be handled like that :

```
FromDateTime(JSONPATH(payload, '$.created_at'), 'yyyy-MM-dd''T''HH:mm:ss[.SSS]''Z''')
```

It's already provided by Java 8 and [DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html), in documentation we have :

```
[ optional section start
] optional section end
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the FromDateTime date-format handling and review how its current formatter processes the supplied pattern. The feature is complete when a pattern with an optional [.SSS] section accepts timestamps both with and without second fractions, while preserving the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
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.