Skip to content

Conversation

@gokselk
Copy link
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
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

@Omega359
Copy link
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
@gokselk gokselk closed this Jan 8, 2026
@gokselk gokselk reopened this Jan 8, 2026
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