title: "Pushdown functions" description: "Functions for use with the filter pushdown feature" menu: main:
parent: 'sql-functions'
try_parse_monotonic_iso8601_timestamp
parses a subset of ISO 8601
timestamps that matches the 24 character length output
of the javascript Date.toISOString() function.
Unlike other parsing functions, inputs that fail to parse return NULL
instead of error.
This allows try_parse_monotonic_iso8601_timestamp
to be used with
the temporal filter pushdown feature on text
timestamps.
This is particularly useful when working with
JSON sources,
or other external data sources that store timestamps as strings.
Specifically, the accepted format is YYYY-MM-DDThh:mm:ss.sssZ
:
-
followed by-
followed byT
followed by:
followed by:
followed by.
Z
, indicating the UTC time zone.Ordinary text
-to-timestamp
casts will prevent a filter from being pushed down.
Replacing those casts with try_parse_monotonic_iso8601_timestamp
can unblock that
optimization for your query.
SELECT try_parse_monotonic_iso8601_timestamp('2015-09-18T23:56:04.123Z') AS ts;
ts
--------
2015-09-18 23:56:04.123
SELECT try_parse_monotonic_iso8601_timestamp('nope') AS ts;
ts
--------
NULL