Como el método de opciones de sqoop está en desuso, puede usar el siguiente código:
public static void importToHive() throws Exception{
Configuration config = new Configuration();
config.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
config.addResource(new Path("/usr/local/hadoop/conf/hdfs-site.xml"));
String[] cmd ={"import", "--connect",<connectionString>,"--username", userName,
"--password", password,"--hadoop-home", "/usr/local/hadoop","--table",<tableName>, "--hive-import","--create-hive-table", "--hive-table",<tableName>,"-target-dir",
"hdfs://localhost:54310/user/hive/warehouse","-m", "1","--delete-target-dir"};
Sqoop.runTool(cmd,config);
}
Utilice la path
adecuada del almacén de Hadoop y Hive , username
, password
para mysql. Verifique su puerto desde core-site.xml
(en mi caso es 54310)