Skip to content

Add support for additional numeric types in to_timestamp functions#19663

Merged
Jefffrey merged 10 commits intoapache:mainfrom
gokselk:feat/to-timestamp-args
Jan 11, 2026
Merged

Add support for additional numeric types in to_timestamp functions#19663
Jefffrey merged 10 commits intoapache:mainfrom
gokselk:feat/to-timestamp-args

Conversation

@gokselk
Copy link
Copy Markdown
Contributor

@gokselk gokselk commented Jan 6, 2026

Which issue does this PR close?

Closes #19117.

Rationale for this change

The to_timestamp function family lacks consistency in supported argument types. While to_timestamp accepts Float64 and Decimal128 types, the related functions (to_timestamp_seconds, to_timestamp_millis, to_timestamp_micros, to_timestamp_nanos) don't offer the same support. Additionally, the documentation claims support for "unsigned integer" types, but this isn't fully implemented.

What changes are included in this PR?

Standardizes all to_timestamp variants to uniformly support:

  • All signed integer types: Int8, Int16, Int32, Int64
  • All unsigned integer types: UInt8, UInt16, UInt32, UInt64
  • Float32 and Float64
  • Decimal128 (for millis/micros/nanos variants)

Are these changes tested?

Yes, added comprehensive SQL logic tests in datafusion/sqllogictest/test_files/datetime/timestamps.slt.

Are there any user-facing changes?

Users can now pass additional numeric types to to_timestamp functions. This is a backward-compatible enhancement.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Jan 6, 2026
Copy link
Copy Markdown
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up; I think we should ensure we support Float16 and all the other decimal variants too, for completeness

Comment thread datafusion/functions/src/datetime/to_timestamp.rs Outdated
Comment thread datafusion/functions/src/datetime/to_timestamp.rs Outdated
Comment thread datafusion/sqllogictest/test_files/datetime/timestamps.slt
Comment thread datafusion/functions/src/datetime/to_timestamp.rs Outdated
@Omega359
Copy link
Copy Markdown
Contributor

Omega359 commented Jan 7, 2026

Thanks for submitting this PR @gokselk, much appreciated.

@gokselk gokselk force-pushed the feat/to-timestamp-args branch from 03c1937 to 1a2facb Compare January 7, 2026 18:41
Comment thread datafusion/sqllogictest/test_files/datetime/timestamps.slt
Comment thread datafusion/functions/src/datetime/to_timestamp.rs Outdated
Comment thread datafusion/functions/src/datetime/to_timestamp.rs
Comment thread datafusion/functions/src/datetime/to_timestamp.rs
@gokselk gokselk closed this Jan 8, 2026
@gokselk gokselk reopened this Jan 8, 2026
@Jefffrey Jefffrey added this pull request to the merge queue Jan 11, 2026
Merged via the queue into apache:main with commit 41a0b85 Jan 11, 2026
28 checks passed
@Jefffrey
Copy link
Copy Markdown
Contributor

Thanks @gokselk, @Omega359 & @martin-g

de-bgunter pushed a commit to de-bgunter/datafusion that referenced this pull request Mar 24, 2026
…pache#19663)

## Which issue does this PR close?

Closes apache#19117.

## Rationale for this change

The `to_timestamp` function family lacks consistency in supported
argument types. While `to_timestamp` accepts Float64 and Decimal128
types, the related functions (`to_timestamp_seconds`,
`to_timestamp_millis`, `to_timestamp_micros`, `to_timestamp_nanos`)
don't offer the same support. Additionally, the documentation claims
support for "unsigned integer" types, but this isn't fully implemented.

## What changes are included in this PR?

Standardizes all `to_timestamp` variants to uniformly support:

- All signed integer types: Int8, Int16, Int32, Int64
- All unsigned integer types: UInt8, UInt16, UInt32, UInt64
- Float32 and Float64
- Decimal128 (for millis/micros/nanos variants)

## Are these changes tested?

Yes, added comprehensive SQL logic tests in
`datafusion/sqllogictest/test_files/datetime/timestamps.slt`.

## Are there any user-facing changes?

Users can now pass additional numeric types to `to_timestamp` functions.
This is a backward-compatible enhancement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to_timestamp udf functions to have a consistent set of argument types

4 participants