使用eclipse连接hive成功,load数据出现MoveTask问题

qq_34114105 2016-09-05 06:02:58
public class hiveServer2 {
public static class HiveJdbcClient {

//private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
private static final String driverName = "org.apache.hive.jdbc.HiveDriver";
private static final String url = "jdbc:hive2://192.168.12.10:10000/default";
private static final String user = "hive";
private static final String password = "hive";
private static String sql;
private static ResultSet res;
private final static Logger log = Logger.getLogger(HiveJdbcClient.class);

public static void main(String[] args) {
try {
Class.forName(driverName);
Connection conn = DriverManager.getConnection(url, user, password);
// 默认使用端口10000, <span style="font-family: Arial, Helvetica, sans-serif;">使用数据库default,用户名为hive,密码为hive</span>
// Connection conn = DriverManager.getConnection(
// "jdbc:hive://192.168.12.10:10000/default
Statement stmt = conn.createStatement();

sql = " load data inpath '/test/table/test1/part-m-00000' INTO TABLE test1 partition(dt='20160000')";//load数据
System.out.println("Running:" + sql);
res = stmt.executeQuery(sql);
System.out.println("执行结果:");
while (res.next()) {
System.out.println(res.getString(1));
}

conn.close();
conn = null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
log.error(driverName + " not found!", e);
System.exit(1);
} catch (SQLException e) {
e.printStackTrace();
log.error("Connection error!", e);
System.exit(1);
}

}
}
}
报错:
java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:283)
at org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:378)
at com.ssmhbase.sample.hiveServer2$HiveJdbcClient.main(hiveServer2.java:34)
17:57:47.384 [main] ERROR com.ssmhbase.sample.hiveServer2$HiveJdbcClient - Connection error!
java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:283) ~[hive-jdbc-2.0.0.jar:2.0.0]
at org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:378) ~[hive-jdbc-2.0.0.jar:2.0.0]
at com.ssmhbase.sample.hiveServer2$HiveJdbcClient.main(hiveServer2.java:34) [classes/:?]
代码测试没错误,换成别的sql比如建表语句,insert语句,都正常
一换成load语句就报错,但是把load语句的sql粘到hive里直接运行,一切正常,这是什么问题啊?
...全文
1392 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
小一12138 2016-09-14
  • 打赏
  • 举报
回复
楼主解决了 我的问题跟你一样 谢谢

7,388

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 数据仓库
社区管理员
  • 数据仓库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧