Hive string to date data type conversion

I have as_of_date column in hive table A datatype as string and in hive table B datatype as timestamp. When we insert the data from table A to table B, i’m getting null values. How do i resolve it?

@Rahul_Hadoop - Can you paste your query and sample data ?

sample data

as_of_date
03/01/2017
03/01/2017

query for table A:
create external table hive_one(as_of_date string) location ‘/xxx/xxx/’

query for table B:
create table hive_two(as_of_date timestamp)

Insert statement:
insert into hive_two select * from hive_one

@Rahul_Hadoop - Since you don’t have timestamp (26 bytes) from source table, you need to concatenate date (10 byte) from source table and remaining hard code (16 bytes) values. I haven’t explored concatenation.

Just practice purpose then you can try to do reverse way keep the time stamp in source and take only the date and insert into new table. (Using substr)

sample data

as_of_date
03/01/2017
03/01/2017

how about If I use date as a data type in hive table B as below

query for table A:
create external table hive_one(as_of_date string) location ‘/xxx/xxx/’

query for table B:
create table hive_two(as_of_date date)

Insert statement:
insert into hive_two select * from hive_one