2

I have a so big db2 table which contains many char type columns.

I try to extract datas to hive via sqoop to fullfill different demands.

In the past time, I manually trim all the char type colums when write Hivesql

However, there are so many colums to trim that I always forget some of them which may result some confused issues like following:

suppose BANK_TABLE is the target table of hive,and 2323423232323 is an existing card number in the table.

if I execute:

hive -e "select * from BANK_TABLE where card_no='2323423232323' "

The result is nothing owning to I forget to trim the column: card_no when I write sql to import data to hive.

So I wonder is there a good way for sqool or for hive to do the 'trim' automatically?

Thank you all!

yqfang
  • 37
  • 6
  • @PSL I know what you mean, but I didn't have any reputation to vote up, I will thrive for more very soon, so I hope you forgive as a freshman as well as my poor Englush, Thanks a lot! – yqfang Feb 05 '15 at 04:33
  • 1
    @PSL Of course I would, seems you are really a serious man, I like you so much! – yqfang Feb 05 '15 at 04:44

1 Answers1

5

Try importing data using Fee Form Query in Sqoop. Within query, use TRIM.

Venkat Ankam
  • 916
  • 11
  • 17