You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Taras Bobrovytsky (JIRA)" <ji...@apache.org> on 2018/03/07 00:47:00 UTC

[jira] [Resolved] (IMPALA-6405) There is no error under Decimal v2 when there is an overflow when casting String to Decimal

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

Taras Bobrovytsky resolved IMPALA-6405.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: Impala 3.0

{noformat}
commit b0027575cbce7002ff867750e955ff3ecd3b1bcd
Author: Taras Bobrovytsky <tb...@cloudera.com>
Date: Wed Jan 17 20:32:11 2018 -0800

IMPALA-6405: Error when string to decimal cast overflows

Before this patch, when there was an error when converting a string to
a decimal, a NULL was returned. In this patch, we change this behavior
so that an error is returned if decimal_v2 is enabled. We also add a
warning if there is an underflow.

The reasoning is that we want stricter behavior in decimal_v2.

Testing:
- Added some EE tests.
- Ran an exhaustive build, which passed.

Change-Id: Icffccac1c1c2361447ae4b0de9b6c2ec7de071db
Reviewed-on: http://gerrit.cloudera.org:8080/9339
Reviewed-by: Dan Hecht <dh...@cloudera.com>
Tested-by: Impala Public Jenkins{noformat}

> There is no error under Decimal v2 when there is an overflow when casting String to Decimal
> -------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-6405
>                 URL: https://issues.apache.org/jira/browse/IMPALA-6405
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.11.0
>            Reporter: Taras Bobrovytsky
>            Assignee: Taras Bobrovytsky
>            Priority: Blocker
>             Fix For: Impala 3.0
>
>
> The following query correctly returns an error when Decimal v2 is enabled:
> {code:java}
> select cast(123 as decimal(2, 0));
> ERROR: UDF ERROR: Decimal expression overflowed
> {code}
> However, this query incorrectly returns a NULL:
> {code}
> select cast("123" as decimal(2, 0))
> +-----------------------------+
> | cast('123' as decimal(2,0)) |
> +-----------------------------+
> | NULL                        |
> +-----------------------------+
> {code}



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