v.22.8Improvement

Adds parseDateTime64BestEffort Functions

Adds parseDateTime64BestEffortUS, parseDateTime64BestEffortUSOrNull, parseDateTime64BestEffortUSOrZero functions, closing #37492. #40015 (Tanya Bragin).
Introduces new functions parseDateTime64BestEffortUS, parseDateTime64BestEffortUSOrNull, and parseDateTime64BestEffortUSOrZero for flexible and efficient parsing of DateTime64 values with microsecond precision.

Why it matters

These functions address the need for robust and forgiving parsing of date-time strings into DateTime64 types with microsecond accuracy. They improve user experience by handling various input formats gracefully and providing options to return null or zero on parse failure, which helps in data cleansing and error handling.

How to use it

Use the functions in your SQL queries by calling them with a string argument containing the date-time value. For example:

SELECT parseDateTime64BestEffortUS('2024-06-01 12:34:56.123456');


The variants parseDateTime64BestEffortUSOrNull and parseDateTime64BestEffortUSOrZero return NULL or 0 respectively if parsing fails, allowing you to handle invalid inputs gracefully.