0

Hi I am trying to figure out if there is a way to directly read a DB table to a sparkR dataframe. I have rstudio installed on an EMR cluster which has my hive metastore on it.

I know I can do the following:

library(sparklyr)
library(dplyr)
sc <- spark_connect(master = "local")
library(DBI)
query <- "select * from schema.table"
result <- dbGetQuery(sc, query) 
result_t <- copy_to(sc,result)

but is there a way to query directly into result_t?

Alper t. Turker
  • 34,230
  • 9
  • 83
  • 115
user295944
  • 273
  • 4
  • 17

1 Answers1

2

Like @kevinykuo suggested,

result_t <- tbl(sc, "schema.table")
user295944
  • 273
  • 4
  • 17