[
https://issues.apache.org/jira/browse/DRILL-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16542948#comment-16542948
]
ASF GitHub Bot commented on DRILL-6472:
---------------------------------------
vvysotskyi opened a new pull request #1380: DRILL-6472: Prevent using zero
precision in CAST function
URL: https://github.com/apache/drill/pull/1380
- Add check for the correctness of scale value;
- Add check for fitting the value to the value with the concrete scale and
precision;
- Implement `negative` UDF for VarDecimal;
- Add unit tests for new checks and UDF.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Drill allows to use decimal zero precision in CAST function for CTAS
> --------------------------------------------------------------------
>
> Key: DRILL-6472
> URL: https://issues.apache.org/jira/browse/DRILL-6472
> Project: Apache Drill
> Issue Type: Bug
> Affects Versions: 1.14.0
> Reporter: Denys Ordynskiy
> Assignee: Volodymyr Vysotskyi
> Priority: Major
> Fix For: 1.14.0
>
>
> I can run query with casting data for decimal with zero precision in SELECT
> statement
> {code:java}
> select cast(1111.05 as decimal(0,5));
> {code}
> {code:java}
> +-------------+
> | EXPR$0 |
> +-------------+
> | 1111.05000 |
> +-------------+
> {code}
> Also I can use this query for CTAS
> {code:java}
> create table dfs.tmp.`zero_pr` as select cast(1111.05 as decimal(0,5));
> {code}
> {code:java}
> +----------+---------------------------+
> | Fragment | Number of records written |
> +----------+---------------------------+
> | 0_0 | 1 |
> +----------+---------------------------+
> {code}
> But when I try to select data from this table, I get an error:
> {code:java}
> create table dfs.tmp.`zero_pr` as select cast(1111.05 as decimal(0,5));
> {code}
> {code:java}
> Error: SYSTEM ERROR: IllegalArgumentException: Invalid DECIMAL precision: 0
> [Error Id: 2e320f55-aa65-4127-82be-6256e0744bdc on maprhost:31010]
> (state=,code=0){code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)