You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Matthew Jacobs (JIRA)" <ji...@apache.org> on 2017/07/31 16:14:00 UTC
[jira] [Resolved] (IMPALA-5529) Add additional function signatures
for TRUNC()
[ https://issues.apache.org/jira/browse/IMPALA-5529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthew Jacobs resolved IMPALA-5529.
------------------------------------
Resolution: Fixed
Fix Version/s: Impala 2.10.0
https://github.com/apache/incubator-impala/commit/15e6cf8fd03e3ae012435592f0bf4d6a64298099
> Add additional function signatures for TRUNC()
> ----------------------------------------------
>
> Key: IMPALA-5529
> URL: https://issues.apache.org/jira/browse/IMPALA-5529
> Project: IMPALA
> Issue Type: New Feature
> Components: Frontend
> Affects Versions: Impala 2.9.0
> Reporter: Greg Rahn
> Assignee: Jinchul Kim
> Labels: built-in-function, newbie
> Fix For: Impala 2.10.0
>
>
> As of Impala 2.9 the current definition of the TRUNC() function is
> {noformat}
> +-------------+--------------------------+-------------+---------------+
> | return type | signature | binary type | is persistent |
> +-------------+--------------------------+-------------+---------------+
> | TIMESTAMP | trunc(TIMESTAMP, STRING) | BUILTIN | true |
> +-------------+--------------------------+-------------+---------------+
> {noformat}
> The additional signatures to be added are:
> {noformat}
> result | function | arguments
> ------------------+----------+-------------------------
> DOUBLE PRECISION | TRUNC | (DOUBLE PRECISION)
> NUMERIC | TRUNC | (NUMERIC(ANY))
> NUMERIC | TRUNC | (NUMERIC(ANY), INTEGER)
> {noformat}
> Examples
> {noformat}
> postgres=# select trunc(cast(42.999 as decimal(5,3)));
> trunc
> -------
> 42
> postgres=# select trunc(cast(42.999 as decimal(5,3)),1);
> trunc
> -------
> 42.9
> postgres=# select trunc(cast(42.999 as double precision));
> trunc
> -------
> 42
> {noformat}
> References:
> - https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/SQLReferenceManual/Functions/Mathematical/TRUNC.htm
> - https://www.postgresql.org/docs/current/static/functions-math.html
> The return precision/scale for a decimal should be the same as the input. For example, trunc(decimal(x,y)) should return decimal(x,y).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)