Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

rhbase hb.insert.data.frame error

65 views
Skip to first unread message

该走了

unread,
Dec 27, 2013, 12:08:06 AM12/27/13
to rha...@googlegroups.com
library(rhbase)
hb
.init()
hb
.describe.table('testtable')
# Not required to labels to be 'family:label', can just provide 'family'
# which is equivalent to 'family:'
hb
.insert("testtable",list(list("20100101",c("x:a","x:f","y","y:w"), list("James Dewey",TRUE, 187.5,189000))))
hb
.insert("testtable",list(list("20100102",c("x:a"), list("James Agnew"))))
hb
.insert("testtable",list(list("20100103",c("y:a","y:w"), list("Dilbert Ashford",250000))))
hb
.insert("testtable",list(list("20100104",c("x:f"), list("Henry Higs"))))


hb
.get("testtable",list("20100101","20100102"))
hb
.get("testtable",list("20100101","20100102"),c("y")) # columns that start with y
hb
.get("testtable",list("20100101","20100102"),c("y:w"))
hb
.get("testtable",list("20100101","20100102"),c("y:w","z"))


# delete
hb
.delete("testtable","20100103","y:a")
hb
.get("testtable","20100103")

## will not get 20100103, since no 'x'
iter
<- hb.scan("testtable",startrow="20100100",colspec="x")
while( length(row <- iter$get(1))>0){
 
print(row)
}
iter$close
()

# scan from beginning
iter
<- hb.scan("testtable",startrow="20100100",colspec=c('x','y','z'))
while( length(row <- iter$get(1))>0){
 
print(row)
}
iter$close
()

# scan uptil 20100103 (not including it)
iter
<- hb.scan("testtable",startrow="20100100",end="20100103",colspec=c('x','y'))
while( length(row <- iter$get(1))>0){
 
print(row)
}
iter$close
()

hb
.new.table('testtable','x','y','z')
x
<- data.frame(x=c("Winston","Jen","Jasmine"), y=runif(3),z=c(1,2,3))
rownames
(x) <- c("20100105","20100106","20100107")
hb
.insert.data.frame("testtable",x)


I ran a simple example of rhbase like this, but when I try to instert  a data.frame, I get an error :
Error in hb.insert.data.frame("testtable", x) : 
  rhbase<addAndSendDFBatch>:: Internal error processing mutateRows

Is there any one know how to fix it? It seems some thing wrong with thrift.
thrift 0.9.1
hadoop 2.2.0
hbase 0.96.1
Reply all
Reply to author
Forward
0 new messages