You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Ashutosh Chauhan (JIRA)" <ji...@apache.org> on 2018/04/17 01:50:00 UTC

[jira] [Comment Edited] (HIVE-19160) Insert data into decimal column fails with Null Pointer Exception

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

Ashutosh Chauhan edited comment on HIVE-19160 at 4/17/18 1:49 AM:
------------------------------------------------------------------

{code}
 Decimal lowValue = aggregateData.getLowValue() != null &&
	          aggregateData.getLowValue().compareTo(newData.getLowValue()) > 0 ?
	          aggregateData.getLowValue() : newData.getLowValue();
{code}

should be 
{code}
 Decimal lowValue = aggregateData.getLowValue() != null &&
	          aggregateData.getLowValue().compareTo(newData.getLowValue()) < 0 ?
	           aggregateData.getLowValue() : newData.getLowValue();
{code}

Since we get a new value which is lower, that is what we want to use and persist in stats.


was (Author: ashutoshc):
{code}
 Decimal lowValue = aggregateData.getLowValue() != null &&
	          aggregateData.getLowValue().compareTo(newData.getLowValue()) > 0 ?
	          aggregateData.getLowValue() : newData.getLowValue();
{code}

should be 
{code}
 Decimal lowValue = aggregateData.getLowValue() != null &&
	          aggregateData.getLowValue().compareTo(newData.getLowValue()) > 0 ?
	          newData.getLowValue() :aggregateData.getLowValue();
{code}

Since we get a new value which is lower, that is what we want to use and persist in stats.

> Insert data into decimal column fails with Null Pointer Exception
> -----------------------------------------------------------------
>
>                 Key: HIVE-19160
>                 URL: https://issues.apache.org/jira/browse/HIVE-19160
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Janaki Lahorani
>            Assignee: Janaki Lahorani
>            Priority: Major
>         Attachments: HIVE-19160.1.patch, HIVE-19160.2.patch, HIVE-19160.3.patch
>
>
> drop table if exists testDecimal;
> create table testDecimal
> (cId        TINYINT,
>  cBigInt    DECIMAL,
>  cInt       DECIMAL,
>  cSmallInt  DECIMAL,
>  cTinyint   DECIMAL);
> insert into testDecimal values
> (1,
>  1234567890123456789,
>  1234567890,
>  12345,
>  123);
> insert into testDecimal values
> (2,
>  1,
>  2,
>  3,
>  4);
> The second insert fails with null pointer exception.
> 2018-04-10T15:23:23,080 ERROR [5dba40ef-be49-4187-8a72-afbb46c41ecc main] metastore.RetryingHMSHandler: java.lang.NullPointerException
> 	at org.apache.hadoop.hive.metastore.api.Decimal.compareTo(Decimal.java:318)
> 	at org.apache.hadoop.hive.metastore.columnstats.merge.DecimalColumnStatsMerger.merge(DecimalColumnStatsMerger.java:35)
> 	at org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.mergeColStats(MetaStoreUtils.java:1040)
> 	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.set_aggr_stats_for(HiveMetaStore.java:7166)
> 	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
> 	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)
> 	at com.sun.proxy.$Proxy40.set_aggr_stats_for(Unknown Source)
> 	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.setPartitionColumnStatistics(HiveMetaStoreClient.java:1870)
> 	at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.setPartitionColumnStatistics(SessionHiveMetaStoreClient.java:395)
> 	at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:212)
> 	at com.sun.proxy.$Proxy41.setPartitionColumnStatistics(Unknown Source)
> 	at org.apache.hadoop.hive.ql.metadata.Hive.setPartitionColumnStatistics(Hive.java:4171)
> 	at org.apache.hadoop.hive.ql.stats.ColStatsProcessor.persistColumnStats(ColStatsProcessor.java:179)
> 	at org.apache.hadoop.hive.ql.stats.ColStatsProcessor.process(ColStatsProcessor.java:83)



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