请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

HiveException: Unable to move source

Exception in thread "main" java.sql.SQLException: org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to move source hdfs://namenode:8020/user/hive/warehouse/staging/_hive_2017-09-29_15-56-24_475_7647432284127920875-3/-ext-10000/part-00000-f3018378-999a-4d3c-92ee-66e747bfa7de-c000 to destination hdfs://namenode:8020/user/hive/warehouse/staging/mydb.db/mytable/part-00000-f3018378-999a-4d3c-92ee-66e747bfa7de-c000; at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:296)

正在回答 回答被采纳积分+3

4回答

提问者 OjQuery 2017-09-29 21:54:04

No rows selected (0.011 seconds)

0: jdbc:hive2://localhost:10000> INSERT into TABLE mytable VALUES (1, '1');

Error: org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to move source hdfs://namenode:8020/user/hive/warehouse/staging/_hive_2017-09-29_21-53-33_467_5456078821325813240-4/-ext-10000/part-00000-5be07e5b-fdad-454f-8015-04eeec527f5a-c000 to destination hdfs://namenode:8020/user/hive/warehouse/staging/mydb.db/mytable/part-00000-5be07e5b-fdad-454f-8015-04eeec527f5a-c000; (state=,code=0)

0: jdbc:hive2://localhost:10000> 


0 回复 有任何疑惑可以回复我~
  • 你这环境就有问题
    回复 有任何疑惑可以回复我~ 2017-09-29 22:08:00
Michael_PK 2017-09-29 19:50:42

你先检查下hiveserver2配合beeline好使不

0 回复 有任何疑惑可以回复我~
提问者 OjQuery 2017-09-29 19:34:33

package com.imooc.spark

import java.sql.DriverManager

/**
*  通过JDBC的方式访问
*/
object SparkSQLThriftServerApp {

 def main(args: Array[String]) {

   Class.forName("org.apache.hive.jdbc.HiveDriver")

   val conn = DriverManager.getConnection("jdbc:hive2://namenode:10000/mydb","hadoop","")
   //val pstmt = conn.prepareStatement("INSERT INTO TABLE address VALUES (1, 1, 1, '测试省', 11, '测试市', 111, '测试区', '2037021', '联系人', '手机号', '详细地址', '2017-9-1 1:1:1', '2017-9-1 1:1:1', '2017-9-1 1:1:1')")
   val pstmt = conn.createStatement()
   val rs = pstmt.executeUpdate("INSERT into TABLE mytable VALUES (1, '1')")
//    while (rs.next()) {
//      println("id:" + rs.getInt("id") +
//        " , user_id:" + rs.getString("name") )
//
//    }

//    rs.close()
   pstmt.close()
   conn.close()


 }


}

0 回复 有任何疑惑可以回复我~
Michael_PK 2017-09-29 16:59:08

什么操作

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信