You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Riza Suminto (Jira)" <ji...@apache.org> on 2020/01/28 22:23:00 UTC

[jira] [Comment Edited] (IMPALA-9280) Time string with signed TZH token preceded by dash cannot be cast to timestamp

    [ https://issues.apache.org/jira/browse/IMPALA-9280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17025470#comment-17025470 ] 

Riza Suminto edited comment on IMPALA-9280 at 1/28/20 10:22 PM:
----------------------------------------------------------------

Hi,

Looking at the datetime-iso-sql-format-parser.cc, it looks like this line in IsoSqlFormatParser::ProcessSeparatorSequence is the one causing this issue.
{code:java}
// The last '-' of a separator sequence might be taken as a sign for timezone hour.
if (*(*current_pos - 1) == '-' && dt_ctx.toks[*current_tok_idx].type == TIMEZONE_HOUR) {
  --(*current_pos);
}{code}
If the previous character is - and the next token is TZH, it will move the pointer back one character to include the - sign as part of TZH.


was (Author: rizaon):
Hi,

Looking at the datetime-iso-sql-format-parser.cc, it looks like this line in IsoSqlFormatParser::ProcessSeparatorSequence is the one causing this issue.
{code:java}
// The last '-' of a separator sequence might be taken as a sign for timezone hour.
if (*(*current_pos - 1) == '-' && dt_ctx.toks[*current_tok_idx].type == TIMEZONE_HOUR) {
  --(*current_pos);
}{code}
If the previous character is '-' and the next token is TZH, it will move the pointer back one character to include the '-' sign as part of TZH.

> Time string with signed TZH token preceded by dash cannot be cast to timestamp
> ------------------------------------------------------------------------------
>
>                 Key: IMPALA-9280
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9280
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 3.3.0
>            Reporter: Jozsef Koza
>            Assignee: Riza Suminto
>            Priority: Minor
>              Labels: newbie
>
> Given a time string containing a TZH token with a sign which is preceded immediately by a dash delimiter cannot be cast to timestamp.
> h3. To reproduce
> Execute {code:sql}
> select cast("08:00-+01" as timestamp format "HH:MI-TZH");{code} which results in *NULL*.
>  
> ----
> It seems like the delimiter is incorrectly recognised as the sign of the timezone offset hour which prevents parsing the TZH value.
>  Adding an additional delimiter (other than dash itself) between the dash separator and the sign in the time string makes cast working.
> Executing
> {code:sql}
> select cast("08:00- +01" as timestamp format "HH:MI-TZH");{code}
> results in *08:00:00*.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org