Gabor Zele created IMPALA-12691:
-----------------------------------

             Summary: conversion of partial date strings to timestamp
                 Key: IMPALA-12691
                 URL: https://issues.apache.org/jira/browse/IMPALA-12691
             Project: IMPALA
          Issue Type: Improvement
            Reporter: Gabor Zele


Currently the TO_TIMESTAMP(STRING date, STRING pattern) function will only 
convert a string to timestamp if it has year, month and day parts.

If I'd like to convert a single year or year/month combination:
{noformat}
SELECT
    TO_TIMESTAMP('2024-01','yyyy-MM'),
    TO_TIMESTAMP('2024','yyyy')
;{noformat}
I always get NULL as result.

To be able to convert these values, especially if there string contains 
something else as well, requires regexp_extract() and some other functions to 
match the partial format and expand it with "01" as default values for 
day/month so CAST/to_timestamp() will work eventually.

If Impala could do the same based on a partial string pattern, then these kind 
of conversions would be much simpler and maintainable.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to