Skip to content

Conversation

krinart
Copy link
Contributor

@krinart krinart commented Sep 19, 2025

Which issue does this PR close?

Required for spiceai/spiceai#7055

Rationale for this change

Most databases use following format for timestamps : 2025-09-15 11:00:00 +00:00
But duckdb fails due to extra space:

Screenshot 2025-09-16 at 2 22 51 PM

What changes are included in this PR?

  • Extended Dialect with timestamp_with_tz_to_string and default implementation
  • Custom timestamp_with_tz_to_string implementation for DuckDBDialect
  • Tests

Are these changes tested?

Manually + unit tests

Are there any user-facing changes?

No

@github-actions github-actions bot added the sql SQL Planner label Sep 19, 2025
@alamb alamb changed the title Custom timestamp format for DuckDB [unparser] Custom timestamp format for DuckDB Sep 19, 2025
@alamb
Copy link
Contributor

alamb commented Sep 19, 2025

@phillipleblanc or @sgrebnov could you help review this PR?

@@ -50,6 +50,7 @@ recursive_protection = ["dep:recursive"]
[dependencies]
arrow = { workspace = true }
bigdecimal = { workspace = true }
chrono = { workspace = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is dependency required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sgrebnov
Copy link
Member

sgrebnov commented Sep 19, 2025

The change makes sense to me/ looks good 👍

I would ideally like to have this new override method be more generic and support more types (at least timestamp w/o tz), but I synched w/ @krinart on this and we have not found any good/elegant solution for this. Thus current implementation looks good to me.

It also seems something we can potentially try to improve in DuckDB as well 😉

@alamb alamb enabled auto-merge September 20, 2025 10:37
@alamb
Copy link
Contributor

alamb commented Sep 20, 2025

Thank you @krinart @sgrebnov and @phillipleblanc !

@alamb alamb added this pull request to the merge queue Sep 20, 2025
Merged via the queue into apache:main with commit 03b6789 Sep 20, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants