Skip to content

fix(presto): transpile FROM_ISO8601_DATE to cast#7778

Merged
georgesittas merged 2 commits into
tobymao:mainfrom
honeydew-ai:fix/from-iso8601-date-transpile
Jun 22, 2026
Merged

fix(presto): transpile FROM_ISO8601_DATE to cast#7778
georgesittas merged 2 commits into
tobymao:mainfrom
honeydew-ai:fix/from-iso8601-date-transpile

Conversation

@baruchoxman

Copy link
Copy Markdown
Contributor

Fixes #7777

FROM_ISO8601_DATE is a Presto/Trino function that parses an ISO 8601 string into a date. It wasn't recognized as a dedicated expression, so it parsed as Anonymous and passed through verbatim to every dialect:

>>> sqlglot.parse_one("SELECT FROM_ISO8601_DATE('2020-05-11')", "trino").sql("snowflake")
"SELECT FROM_ISO8601_DATE('2020-05-11')"   # before — invalid outside Presto/Trino
"SELECT CAST('2020-05-11' AS DATE)"        # after

Change

  • Add a dedicated exp.FromISO8601Date expression.
  • Transpile it to CAST(... AS DATE) in the base Generator, so all dialects handle it (Snowflake, Spark, BigQuery, DuckDB, …).
  • Add an explicit exp.FromISO8601Date transform to the Presto generator so Presto/Trino keep emitting the native function.

This mirrors the from_iso8601_timestamp fix in #7776.

🤖 Generated with Claude Code

@baruchoxman baruchoxman changed the title fix(presto): transpile FROM_ISO8601_DATE to cast [CLAUDE] fix(presto): transpile FROM_ISO8601_DATE to cast Jun 21, 2026
FROM_ISO8601_DATE is a Presto/Trino function parsing an ISO 8601 string
into a date. It wasn't recognized as a dedicated expression, so it
parsed as Anonymous and passed through unchanged to all dialects. Add a
FromISO8601Date expression, transpile it to CAST(... AS DATE) in the base
Generator, and keep the native function for Presto/Trino.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@baruchoxman baruchoxman force-pushed the fix/from-iso8601-date-transpile branch from 3016c85 to a381dfe Compare June 21, 2026 21:10

@georgesittas georgesittas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@georgesittas georgesittas merged commit 43a3d9f into tobymao:main Jun 22, 2026
8 checks passed
@baruchoxman

Copy link
Copy Markdown
Contributor Author

Thanks!

@georgesittas thanks for approving and merging! Any chance you could make a new release soon, that would include this ?

@georgesittas

Copy link
Copy Markdown
Collaborator

There's no fixed released cadence, but we release often. Likely sometime this week.

@georgesittas

Copy link
Copy Markdown
Collaborator

I just release v30.12.0, should be live within a few minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_iso8601_date is not correctly transpiled from Trino to other dialects

2 participants