You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Aman Sinha (Jira)" <ji...@apache.org> on 2021/02/17 02:39:00 UTC

[jira] [Resolved] (IMPALA-9745) SELECT from view fails with "AnalysisException: No matching function with signature: to_timestamp(TIMESTAMP, STRING)" after expression rewrite.

     [ https://issues.apache.org/jira/browse/IMPALA-9745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aman Sinha resolved IMPALA-9745.
--------------------------------
    Fix Version/s: Impala 4.0
       Resolution: Fixed

> SELECT from view fails with "AnalysisException: No matching function with signature: to_timestamp(TIMESTAMP, STRING)" after expression rewrite.
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-9745
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9745
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 2.11.0, Impala 4.0
>            Reporter: Andrew Sherman
>            Assignee: Aman Sinha
>            Priority: Critical
>             Fix For: Impala 4.0
>
>
> Simple test case
> {code}
> drop view if exists test_replication_view;
> drop table if exists test_replication;
> create table test_replication(cob string);
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-08');
> select * from test_replication;
> create view test_replication_view as select to_timestamp(cob, 'yyyy-MM-dd') cob_ts,cob trade_date from test_replication;
> select 1 from test_replication_view deal WHERE trade_date = deal.cob_ts AND deal.cob_ts = '2018-06-07';
> {code}
> The problem seems to be that after expression rewrite the type of cob has become a timestamp and so we look for the function "to_timestamp(TIMESTAMP, STRING)" instead of "to_timestamp(STRING, STRING)".
> A workaround is to run with
> {code}
> set enable_expr_rewrites=false;
> {code}
> For comparison a similar query runs OK in mysql
> {code}
> drop view if exists test_replication_view;
> drop table if exists test_replication;
> create table test_replication(cob varchar(255));
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-07');
> insert into test_replication values('2018-06-08');
> select * from test_replication;
> create view test_replication_view as select str_to_date(cob, '%Y-%m-%d') cob_ts,cob trade_date from test_replication;
> select 1 from test_replication_view deal WHERE trade_date = deal.cob_ts AND deal.cob_ts = '2018-06-07'
> {code}



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