You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@sqoop.apache.org by Jarek Jarcec Cecho <ja...@gmail.com> on 2012/01/09 08:45:13 UTC

Re: [sqoop-user] Re: CAST function in the query failed

[Moving the thread to sqoop-user@incubator.apache.org. Please subscribe to this list]

Hi Hanjie,
casting inside --query parameter should be working. I believe that your issue is caused by wrong column name that is retrieved from MySQL meta data and is passed to hive. Can you please try using SQL projection and rename casted column? Something like SELECT CAST(page_title AS CHAR(255)) AS page_title, ...?

Jarcec

On Sun, Jan 08, 2012 at 08:07:05PM -0800, Hanjie wrote:
> Sorry I forgot to mention. I'm using Sqoop 1.4.1-incubating-SNAPSHOT
> built with Hadoop 0.20.205
> 
> On Jan 8, 8:05 pm, Hanjie <ha...@gmail.com> wrote:
> > I have following query performed through jdbc:mysql :
> >
> > --query 'SELECT CAST(page_title AS CHAR(255)), page_id, page_namespace
> > from page WHERE $CONDITIONS LIMIT 100'
> >
> > And this is the error I got:
> > hive.HiveImport: FAILED: Parse Error: line 1:56 cannot recognize input
> > near 'CHAR' '(' '255' in column type
> >
> > page_title was stored as varbinary(255).
> > Sqoop doesn't seem to support automatically convert varbinary(255) to
> > string for the moment. I tried manually cast varbinary to char, which
> > didn't work out either. Does sqoop support CAST in the query?
> >
> > Thank you very much!
> >
> > Hanjie
> 
> -- 
> NOTE: The mailing list sqoop-user@cloudera.org is deprecated in favor of Apache Sqoop mailing list sqoop-user@incubator.apache.org. Please subscribe to it by sending an email to incubator-sqoop-user-subscribe@apache.org.