1

I am in GMT +0800. When I use hive to process column of timestamp, if this column is in a struct type column, there will be the following.

hive> desc ts;
t                       timestamp                                   
s                       struct<t_struct:timestamp>                      

hive> select * from ts;
1970-01-01 08:00:00 {"t_struct":"1970-01-01 00:00:00"}

and I insert a new line:

hive> insert into ts select * from ts;

show the table data again:

hive>  select * from ts;
1970-01-01 08:00:00 {"t_struct":"1969-12-31 16:00:00"}
1970-01-01 08:00:00 {"t_struct":"1970-01-01 00:00:00"}

The colunm tstruct is wrong. What should I do to solve this problem?

ps:When I use spark SQL to connect hive not find the mistake. But with MR or Tez find the mistake.

thinks.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
xuejianbest
  • 323
  • 1
  • 9
  • Try to use STRING instead of Timestamp data type for the same – leftjoin Jul 23 '18 at 06:25
  • @leftjoin, hive doesn't support timestamp in struct? – Arun Aug 15 '18 at 00:09
  • 1
    @Arunachalam It can be a timezone issue. Hive works with timezones strange. And I do not know how to fix similar issues except using STRING. Look at this: https://stackoverflow.com/a/51591735/2700344 – leftjoin Aug 15 '18 at 04:18

0 Answers0