orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Swor (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ORC-425) Wrong error message when setting decimal precision to an invalid value
Date Mon, 29 Oct 2018 23:53:00 GMT
Steven Swor created ORC-425:
-------------------------------

             Summary: Wrong error message when setting decimal precision to an invalid value
                 Key: ORC-425
                 URL: https://issues.apache.org/jira/browse/ORC-425
             Project: ORC
          Issue Type: Bug
            Reporter: Steven Swor


With decimal types, *precision* is the total number of digits in the decimal representation,
and *scale* is the number of digits to the right of the decimal place. Currently, {{TypeDescription.withPrecision()}}
checks the the precision argument and throws {{IllegalArgumentException}} if it's out of bounds.
However, the error message is confusing and probably incorrect.

The following snippet:
{code:java}
TypeDescription invalidDecimal = TypeDescription.createDecimal().withScale(10).withPrecision(5);{code}
results in this exception:
{code:java}
java.lang.IllegalArgumentException: precision 5 is out of range 1 .. 10 at org.apache.orc.TypeDescription.withPrecision(TypeDescription.java:427)
~[orc-core-1.5.3.jar:1.5.3]
...{code}
The error message is confusing and probably incorrect. The value {{5}} is within the range
of {{1 .. 10}}

Instead it should probably read something like:
{code:java}
java.lang.IllegalArgumentException: precision 5 was less than scale 10 org.apache.orc.TypeDescription.withPrecision(TypeDescription.java:427)
~[orc-core-1.5.3.jar:1.5.3]
...{code}



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

Mime
View raw message