Add from_date_string as example Trino routine#19968
Conversation
|
As a side note, I couldn't get nested If's to work. |
|
Excellent work @kevinjqliu .. I will review and test later today |
Maybe it works if you put the nested if into a separate begin/end block .. |
mosabua
left a comment
There was a problem hiding this comment.
Very nice example... just a few more tweaks and gotchas to add
4117517 to
b7223fc
Compare
1ab3335 to
0b4b5fa
Compare
|
BTW @mosabua, Trino SQL routines with multiple |
|
Yeah .. DBeaver has the same problem .. we had to update the CLI to support that as well |
|
@mosabua is |
Ooops .. typo from my end |
|
@mosabua fixed |



Description
This PR adds a new example to the Trino Routines Examples page.
The new example routine is named
from_date_string. It takes a date string represented byVARCHARand tries to best effort parse it intoTIMESTAMP.The parsing logic assumes the date string is in one of the
YYYYmmdd,YYYYmmddHH, or ISO 8601 formats.Use case: Hive table partitions are typically represented in one of these formats. It's cumbersome to figure out which date string format is used on a specific table. This routine takes care of the date string parsing regardless of the format.
Additional context and related issues
Saw https://trino.io/blog/2023/11/09/routines and wanted to give the new routines a try
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: