rhive.write.table: Table 已创建但未插入所有行

rhive.write.table: Table created but all the rows were not inserted

我使用以下代码导入csv数据并在Hive中成功创建了table,但也出现了错误消息;

    > base2<-read.csv("/home/hadoop/R/base.csv")
    > base2
        id devid  name
    1   7  1007      R
    2   8  1008 python
    3   9  1009   Ruby

    > rhive.write.table(base2, tableName = 'base2', sep=',') 

    Error: java.sql.SQLException: Query returned non-zero code: 40000,     
    cause: FAILED: SemanticException Line 1:17 Invalid 
    path ''/rhive/data/root/base2_64dbfcaf0e6fbd092165717b91de64'': No 
    files matching path 
    hdfs://master:9000/rhive/data/root/base2_64dbfcaf0e6fbd092165717b91de64

我们可以找到已经在 table 列表中创建的 base2 table,但是根本没有插入任何行:

    > rhive.list.tables()
           tab_name
  1        base
  2        base2
  3        emplyoee

    > rhive.query("SELECT * FROM base2")
  [1] base2.id    base2.devid base2.name
  <0 rows> (or 0-length row.names)

我找到原因是"defaultFS"没有设置好,修改后对我来说很好

    rhive.connect("172.22.25.162",hiveServer2=FALSE,defaultFS="hdfs://master:9000")