I have created a Spark dataframe called "iris" using the below
library(sparklyr)
library(dplyr)
sc <- spark_connect(master = "local")
iris_tbl <- copy_to(sc, iris)
now I want to delete the Spark dataframe "iris" (not the dataframe in R) how do I do that?
This strictly depends on what you when say delete dataframe. You have to remember that in general, Spark data frames are not the same type of objects as you plain local data structures. Spark
DataFrame
is rather a description than a data container.sparklyr
itself, depends primarily on Spark SQL interface. When you callcopy_to
(or any other data import method, it:This means that the natural way to delete dataframe is to drop the temporary view (referencing it by its name either with
dplyr
/dbplyr
:or Spark's own methods:
Please note that it will invalidate local bindings, so any attempt to access
iris_tbl
after calling any of the methods shown above will fail: