[
https://issues.apache.org/jira/browse/ORC-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16667904#comment-16667904
]
Steven Swor commented on ORC-425:
---------------------------------
not sure how to add the proper links, but this issue is related to ORC-150 and
ORC-198.
> 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
> Priority: Trivial
>
> 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)