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 "Paul Rogers (JIRA)" <ji...@apache.org> on 2019/03/01 17:51:00 UTC

[jira] [Assigned] (IMPALA-7964) Inconsistent typing of pure-constant expressions

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

Paul Rogers reassigned IMPALA-7964:
-----------------------------------

    Assignee:     (was: Paul Rogers)

> Inconsistent typing of pure-constant expressions
> ------------------------------------------------
>
>                 Key: IMPALA-7964
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7964
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.1.0
>            Reporter: Paul Rogers
>            Priority: Minor
>
> Impala implements a very subtle rule for computing the type of constant expressions. See IMPALA-4213. The desired rules when performing constant folding are:
> * Pure-literal numeric expressions take the natural (smallest) type of the result.
> * All other expressions preserve the type of the expression.
> Examples:
> {noformat}
>  -- simple literal
> 100 -> 100:TINYINT
>  -- explicit cast
> CAST(100 AS SMALLINT) --> 100:SMALLINT
>  -- pure literal expression
> 2 + 3 --> 5:TINYINT
>   -- addition is done at next wider type up from that of tinyint_col
> tinyint_col + 3 --> SMALLINT
>  -- explicit type given, math done with that type, mimics above
> CAST(2 AS TINYINT) + 3 --> 5:SMALLINT
>  -- Impala uses C++ semantics, with overflow
> CAST(257 AS TINYINT) --> 2:TINYINT
> {noformat}
> At present, some parts of the code follow these rules, but the constant folding rule does not. As a result, {{PlannerTest}} fails for subtle changes in unrelated areas. Some {{PlannerTest}} results, such as the Kudu test mentioned in IMPALA-4213 do observe the rules. But, some constant folding test *do not* observe the rules.
> Expected that the rules would be followed on all code paths to ensure consistent results.



--
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