Support Questions
Find answers, ask questions, and share your expertise

String data type issue in hive 1.2 (HDP 2.3)


Hi All ,

I have two hadoop environments installed one is HDP 2.1(hive 0.13) another is HDP 2.3 (hive 1.2) and have same table 'xyz' in hive both environments.

This 'xyz' table has date field of format '2015-01-01 00:00:00.0'(this is partitioned column). I have gave data type sting for this column in both environment. Now when I try to execute year(date_column) on HDP 2.1(i.e hive 0.13) I am getting result.

But same function when I try to execute on HDP 2.3(i.e hive 1.2) for some fields I am getting result but for some field getting value 0. (I tried changing data type to timestamp but still issue persist)

Is there any parameter I need to set in new hdp version ?

Please let me know if any clarification require.

Thanks ,

Vishal Dhavale


Re: String data type issue in hive 1.2 (HDP 2.3)

Hi @Vishal Dhavale, I just tried in Hive-1.2 (HDP-2.4) and it works for me. The argument to "year" should be string. I tested on 4 strings as below. Can you make sure your input argument to "year" is the right (expected) string.

hive> create external table yr(s string) location "/user/it1/yr";
hive> select year(s), s from yr;
1975	1975-01-01 00:00:00
1999	1999-10-12
2016	2016-03-22 10:20:30.155
2001	2001-07-07 11:00:05.0

Re: String data type issue in hive 1.2 (HDP 2.3)

Hello @Vishal Dhavale. I concur with Predrag - I was not able to create this error either. Can you please post the create table DDL (via 'show create table xyz') and also post the select statement you were running? That would help us get to the bottom of the problem. Thanks!