Description
create temporary table dec (a decimal(38,18)); insert into dec values(100.0); hive> select a*a from dec; OK NULL Time taken: 0.165 seconds, Fetched: 1 row(s)
Looks like the reason is because the result of decimal(38,18) * decimal(38,18) only has 2 digits of precision for integers:
hive> set hive.explain.user=false; hive> explain select a*a from dec; OK STAGE DEPENDENCIES: Stage-0 is a root stage STAGE PLANS: Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: TableScan alias: dec Select Operator expressions: (a * a) (type: decimal(38,36)) outputColumnNames: _col0 ListSink Time taken: 0.039 seconds, Fetched: 15 row(s)
Attachments
Attachments
Issue Links
- is blocked by
-
HIVE-15334 HIVE-13945 changed scale rules for division
- Resolved
- is related to
-
HIVE-27553 After upgrading from Hive1 to Hive3, Decimal computation experiences a loss of precision
- Open
-
SPARK-22036 BigDecimal multiplication sometimes returns null
- Resolved
- links to