Support Questions

Find answers, ask questions, and share your expertise

HDP Sandbox 2.6.5 sqoop date query

avatar
Explorer

Hi,

I'm trying to import a query from pgsql into HDFS using sqoop:

 

--query 'select count(username), date(jointime), productid, flag, currency, credit, sum(totalbet) as tb, sum(bet_count) as bc from customers where credit>= 0 and date(jointime) = cast('2022-01-01' as date) and $CONDITIONS group by date(jointime), productid, credit, flag, currency'

 

but get the error 'cannot cast type integer into date' due to the specified 1st Jan date..

 

how can i get around this issue? also when i tried writing date in timestamp version (yyyy-mm-dd hh:mm:ss) that didn't work either

1 REPLY 1

avatar
Master Collaborator

Hi,

 

-> Can you try with -Doraoop.timestamp.string=false property?

-> Can you try with sqoop type mapping parameters as per below doc and see?

https://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_java_sql_timestamp:~:text=on%20all%20databa...

 

Regards,

Chethan YM