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 "Tim Armstrong (JIRA)" <ji...@apache.org> on 2019/04/25 00:04:00 UTC

[jira] [Updated] (IMPALA-8230) ERROR: AnalysisException: No matching function with signature: trunc(DOUBLE, SMALLINT).

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

Tim Armstrong updated IMPALA-8230:
----------------------------------
    Description: 
trunc()/truncate() have one and two argument versions. The two argument version takes a number of decimal places to truncate to. A one argument version that takes a double argument exists, and a two argument version that takes a decimal argument exists, but we don't have a two argument one that takes a double.

{noformat}
[localhost:21050] default> select trunc(1.2, 1);
Query: select trunc(1.2, 1)
Query submitted at: 2019-04-24 17:02:19 (Coordinator: http://tarmstrong-box:25000)
Query progress can be monitored at: http://tarmstrong-box:25000/query_plan?query_id=6b430dd19607cecb:aa88ef9600000000
+---------------+
| trunc(1.2, 1) |
+---------------+
| 1.2           |
+---------------+
Fetched 1 row(s) in 0.11s
[localhost:21050] default> select trunc(cast(1.2 as double), 1);
Query: select trunc(cast(1.2 as double), 1)
Query submitted at: 2019-04-24 17:02:21 (Coordinator: http://tarmstrong-box:25000)
ERROR: AnalysisException: No matching function with signature: trunc(DOUBLE, TINYINT).
{noformat}

It looks like we don't have an implementation of two-argument trunc() for doubles:
{noformat}
[localhost:21050] default> show functions in _impala_builtins;
...
| DECIMAL(*,*) | trunc(DECIMAL(*,*))                                         | BUILTIN     | true          |
| DECIMAL(*,*) | trunc(DECIMAL(*,*), BIGINT)                                 | BUILTIN     | true          |
| DECIMAL(*,*) | trunc(DECIMAL(*,*), INT)                                    | BUILTIN     | true          |
| DECIMAL(*,*) | trunc(DECIMAL(*,*), SMALLINT)                               | BUILTIN     | true          |
| DECIMAL(*,*) | trunc(DECIMAL(*,*), TINYINT)                                | BUILTIN     | true          |
| DOUBLE       | trunc(DOUBLE)                                               | BUILTIN     | true          |
| TIMESTAMP    | trunc(TIMESTAMP, STRING)                                    | BUILTIN     | true          |
| DECIMAL(*,*) | truncate(DECIMAL(*,*))                                      | BUILTIN     | true          |
| DECIMAL(*,*) | truncate(DECIMAL(*,*), BIGINT)                              | BUILTIN     | true          |
| DECIMAL(*,*) | truncate(DECIMAL(*,*), INT)                                 | BUILTIN     | true          |
| DECIMAL(*,*) | truncate(DECIMAL(*,*), SMALLINT)                            | BUILTIN     | true          |
| DECIMAL(*,*) | truncate(DECIMAL(*,*), TINYINT)                             | BUILTIN     | true          |
| DOUBLE       | truncate(DOUBLE)                                            | BUILTIN     | true          |
{noformat}

> ERROR: AnalysisException: No matching function with signature: trunc(DOUBLE, SMALLINT).
> ---------------------------------------------------------------------------------------
>
>                 Key: IMPALA-8230
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8230
>             Project: IMPALA
>          Issue Type: Bug
>    Affects Versions: Impala 2.12.0
>            Reporter: qinzl_1
>            Priority: Major
>
> trunc()/truncate() have one and two argument versions. The two argument version takes a number of decimal places to truncate to. A one argument version that takes a double argument exists, and a two argument version that takes a decimal argument exists, but we don't have a two argument one that takes a double.
> {noformat}
> [localhost:21050] default> select trunc(1.2, 1);
> Query: select trunc(1.2, 1)
> Query submitted at: 2019-04-24 17:02:19 (Coordinator: http://tarmstrong-box:25000)
> Query progress can be monitored at: http://tarmstrong-box:25000/query_plan?query_id=6b430dd19607cecb:aa88ef9600000000
> +---------------+
> | trunc(1.2, 1) |
> +---------------+
> | 1.2           |
> +---------------+
> Fetched 1 row(s) in 0.11s
> [localhost:21050] default> select trunc(cast(1.2 as double), 1);
> Query: select trunc(cast(1.2 as double), 1)
> Query submitted at: 2019-04-24 17:02:21 (Coordinator: http://tarmstrong-box:25000)
> ERROR: AnalysisException: No matching function with signature: trunc(DOUBLE, TINYINT).
> {noformat}
> It looks like we don't have an implementation of two-argument trunc() for doubles:
> {noformat}
> [localhost:21050] default> show functions in _impala_builtins;
> ...
> | DECIMAL(*,*) | trunc(DECIMAL(*,*))                                         | BUILTIN     | true          |
> | DECIMAL(*,*) | trunc(DECIMAL(*,*), BIGINT)                                 | BUILTIN     | true          |
> | DECIMAL(*,*) | trunc(DECIMAL(*,*), INT)                                    | BUILTIN     | true          |
> | DECIMAL(*,*) | trunc(DECIMAL(*,*), SMALLINT)                               | BUILTIN     | true          |
> | DECIMAL(*,*) | trunc(DECIMAL(*,*), TINYINT)                                | BUILTIN     | true          |
> | DOUBLE       | trunc(DOUBLE)                                               | BUILTIN     | true          |
> | TIMESTAMP    | trunc(TIMESTAMP, STRING)                                    | BUILTIN     | true          |
> | DECIMAL(*,*) | truncate(DECIMAL(*,*))                                      | BUILTIN     | true          |
> | DECIMAL(*,*) | truncate(DECIMAL(*,*), BIGINT)                              | BUILTIN     | true          |
> | DECIMAL(*,*) | truncate(DECIMAL(*,*), INT)                                 | BUILTIN     | true          |
> | DECIMAL(*,*) | truncate(DECIMAL(*,*), SMALLINT)                            | BUILTIN     | true          |
> | DECIMAL(*,*) | truncate(DECIMAL(*,*), TINYINT)                             | BUILTIN     | true          |
> | DOUBLE       | truncate(DOUBLE)                                            | BUILTIN     | true          |
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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