0
votes

I am new to HDFS, Hive, Sqoop and learning the concepts now. I have a question here. I have created a Hive table with "ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE"

I have imported an oracle table data to the Hive table using Hive [I have used --Hive-import option] that I have created. I was hoping that the table data file in HDFS will have columns delimited by commas. But it is not the case. Columns are not delimited by commas in the HDFS file. Is this the default behavior or am I missing something.

Kindly clarify. Thanks in advance!

1
Did you include `--fields-terminated-by ,' ? Although I thought the default was a comma. What's your full sqoop command?Andrew
@Andrew While creating the Hive table, I have included the "fields terminated by" clause code sqoop import --connect <My_database_instance_details> --username <my_username> -P --table dummy.sample_table --columns "<Columns_names_separated_by_comma>" --hive-import --hive-table Sample_sqoop_tabD789rul

1 Answers

0
votes

As per hive docs

--hive-import

Imports tables into Hive using Hive's default delimiters if none are explicitly set.

Hive's default delimiter - fields terminated by : CTRL A and lines terminated by : \n

So this is expected behavior. If you want to replace your own string (","), you can use --hive-delims-replacement.

sqoop import --connect jdbc:oracle_string//localhost:3306/mydb \
--username user --password pwd --table oracletbl \
--hive-import --hive-overwrite \
--hive-table hivedb.hivetbl -m 1 \
--hive-delims-replacement "," \
--null-string '\\N' \
--null-non-string '\\N' \