0
votes

I am importing data from teradata to hive using Sqoop.

I added --map-column-hive in sqoop import command

--map-column-hive col1=int,col2=float,col3=decimal,col4=timestamp,col5=varchar

I got exception:

FAILED: ParseException line 1:234 mismatched input ',' expecting ( near 'varchar' in primitive type specification

Then I tried:

--map-column-hive col1=int,col2=float,col3=decimal,col4=timestamp,col5=varchar(255)

I got:

bash: syntax error near unexpected token `('

How to handle char, varchar and decimal in this?

1

1 Answers

1
votes

After checking source code and tracking issue related to this. I found:

For --map-column-hive tag

  1. Without precision and scale

    key=value

    e.g. col1=int

  2. With Precision

    key = "value(precision)" (can be in single quotes)

    e.g. col2="varchar(255)"

  3. With Scale

    There is a bug for this, fixed in Sqoop 1.4.7

    Fix is not straightforward. For example, for a column col3=decimal(1,1) one need to write col3=decimal(1%2C1)

    Check SQOOP-2103 issue for more details