Using Sybase Adaptive Server Enterprise (ASE) 15.7, Sqoop 188.8.131.52.5.0.0-1245 and jconn4 as driver.
I have a table in Sybase ASE with some columns of type 'char' with various length (sometimes called precision in metadata dump), some at 10, some at 1 - so basically char(10) and char(1).
When importing with scoop with table creation it maps the char columns wrongly.
Doing something like this
sqoop import --driver com.sybase.jdbc4.jdbc.SybDriver --connect "jdbc:sybase:Tds:XXX/XXX" --username XXX --password-file XXX --table XXX -m 1 --create-hcatalog-table ...
I notice it gets the column type readout wrong for the char columns. It says 0 for Precision, not 10, 1 or whatever is chosen in Sybase.
18/07/24 10:18:36 INFO hcat.SqoopHCatUtilities: Database column name - info map : ... XXX : [Type : 1,Precision : 0,Scale : 0] ...
Later, at create table phase, it decides to map the char columns to char(65535) no matter the actual length in Sybase, like this
18/07/24 10:18:36 INFO hcat.SqoopHCatUtilities: HCatalog Create table statement: create table `XXX`.`XXX` ( `XXX` char(65535), ...
That then fails, as char is only valid in Hive between 1 and 255.
18/07/24 10:18:42 INFO hcat.SqoopHCatUtilities: FAILED: RuntimeException Char length 65535 out of allowed range [1, 255]
I can override the wrong automatic mapping manually with --map-column-hive XXX="char(10)", but I want to avoid that as I need it automatically to work for a lot of tables.
Hope anyone can help fix this issue. Thanks.
Got it working now by using another driver. Using net.sourceforge.jtds.jdbc.Driver it works (instead of com.sybase.jdbc4.jdbc.SybDriver). A little strange it doesn't work with Sybase's own drivers.