apache / apache/datafusion

Support type coercion between timestamp and unixtime

Open
#12,891 1 comment 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?

Say there's a table consisting of a timestamp column with the precision seconds. If we can support type coercion between timestamp and unixtime, a query `SELECT * FROM tbl WHERE ts > 1723527660` would be regarded legal and there's no need to wrap the unixtime with the function `from_unixtime`.

### Describe the solution you'd like

Add a cast path between timestamp and unixtime, and try to cast a integer to a certain timestamp type when building a plan. Reports an error when such a cast fails.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the type-coercion cast path and the plan-building step described in the issue. Define how timestamp and unixtime values are coerced, including integer-to-timestamp planning, then verify that invalid casts produce an error and that the shown timestamp comparison is accepted.

Written by the indexing model from the issue text.

Assessment

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