apache / apache/datafusion

Implement `with_timezone` function

Open
#5,905 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

per discussion in https://github.com/apache/arrow-rs/issues/1936#issuecomment-1309690020
casting now consider timezone

i'd like a new function `with_timezone` that could simply change the timezone in datatype without changing any underline value

### Describe the solution you'd like

implement a new function `with_timezone(Timestamp, 'Some-TimeZone')`

e.g.
`with_timezone(timestamp '2000-01-01T00:00:00', '+08:00')` becomes `2000-01-01T08:00:00+08:00`
`with_timezone(with_timezone(timestamp '2000-01-01T00:00:00', '+08:00'), '+07:00')` becomes `2000-01-01T07:00:00+07:00`

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating existing timestamp and timezone function entry points and their tests; the issue does not name specific files. Use the examples to verify that the function changes the displayed timezone without changing the underlying value, including repeated timezone changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
database
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.