Sadique Manzar
Sadique Manzar

Reputation: 121

Hive type casting error from Int to varchar

I have a partition TABLEA with column datatype INT. Created a TABLEB with column datatype Varchar. Pushed the data into TABLEB from TABLEA.

select * from TABLEB with limit is working.

select * from TABLEB failing giving below error.

select count(columnname) from TABLEB failing :

Error: java.io.IOException: java.io.IOException: java.lang.RuntimeException: java.lang.ClassCastException:org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector cannot be cast to org.apache.hadoop.hive.ql.exec.vector.LongColumnVector

Upvotes: 1

Views: 7857

Answers (1)

ems
ems

Reputation: 990

When you are pushing data into TABLEB use type casting for the column. Ex:

insert into TABLEB
select
cast(columnname as string) as columnname
from TABLEA

Upvotes: 1

Related Questions