[ https://issues.apache.org/jira/browse/IMPALA-7886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Rogers resolved IMPALA-7886. --------------------------------- Resolution: Fixed > NumericLiteral constructor fails to round values to Decimal type > ---------------------------------------------------------------- > > Key: IMPALA-7886 > URL: https://issues.apache.org/jira/browse/IMPALA-7886 > Project: IMPALA > Issue Type: Bug > Components: Frontend > Affects Versions: Impala 3.0 > Reporter: Paul Rogers > Assignee: Paul Rogers > Priority: Minor > > According to the SQL spec, section 4.4, regarding numeric assignment: > bq. If least significant digits are lost, implementation defined rounding or > truncating occurs, with no exception condition being raised > When creating a {{NumericLiteral}} via the constructor, no rounding occurs. > The value has more precision than specified by the type. > Create a NumericLiteral and test it as follows: > {code:java} > NumericLiteral n = new NumericLiteral(new BigDecimal("1.567"), > ScalarType.createDecimalType(2, 1)); > assertEquals(ScalarType.createDecimalType(2, 1), n.getType()); > assertEquals("1.6", n.getValue().toString()); > {code} > The above test fails because the value in the literal is “1.567”, it has not > been rounded to fit the type of the literal as required by the SQL standard. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org