[ 
https://issues.apache.org/jira/browse/CALCITE-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17199876#comment-17199876
 ] 

Jiatao Tao edited comment on CALCITE-4240 at 9/22/20, 6:51 AM:
---------------------------------------------------------------

If you execute `{{create table test (a decimal(1,3));`}} in *MySQL*, will occur 
error: 

{{Schema Error: Error: ER_M_BIGGER_THAN_D: For float(M,D), double(M,D) or 
decimal(M,D), M must be >= D (column 'a').}}

 

Also in *Spark/hive*:

{{scala> spark.sql("CREATE TABLE foo (a DECIMAL(5, 7))").collect}}

org.apache.spark.sql.catalyst.parser.ParseException: Decimal scale (7) cannot 
be greater than precision (5).

 

hive> CREATE TABLE foo (a DECIMAL(5, 7));
 2020-09-22 14:38:55,062 FAILED: IllegalArgumentException Decimal scale must be 
less than or equal to precision


was (Author: aron.tao):
If you execute `{{create table test (a decimal(1,3));`}} in *MySQL*, will occur 
error: 

{{Schema Error: Error: ER_M_BIGGER_THAN_D: For float(M,D), double(M,D) or 
decimal(M,D), M must be >= D (column 'a').}}

 

Also in *Spark/hive*:

{{scala> spark.sql("CREATE TABLE foo (a DECIMAL(5, 7))").collect}}

org.apache.spark.sql.catalyst.parser.ParseException:
 Decimal scale (7) cannot be greater than precision (5).

 

hive> CREATE TABLE foo (a DECIMAL(5, 7));
 2020-09-22 14:38:55,062 FAILED: IllegalArgumentException Decimal scale must be 
less than or equal to precision

> SqlTypeUtil#getMaxPrecisionScaleDecimal will create decimal that has the same 
> precision and scale
> -------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4240
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4240
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Jiatao Tao
>            Assignee: Jiatao Tao
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to