aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests/test_sparkSQL.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/pkg/inst/tests/test_sparkSQL.R')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R156
1 files changed, 78 insertions, 78 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 1768c57fd0..1857e636e8 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -23,7 +23,7 @@ context("SparkSQL functions")
sc <- sparkR.init()
-sqlCtx <- sparkRSQL.init(sc)
+sqlContext <- sparkRSQL.init(sc)
mockLines <- c("{\"name\":\"Michael\"}",
"{\"name\":\"Andy\", \"age\":30}",
@@ -67,25 +67,25 @@ test_that("structType and structField", {
test_that("create DataFrame from RDD", {
rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) })
- df <- createDataFrame(sqlCtx, rdd, list("a", "b"))
+ df <- createDataFrame(sqlContext, rdd, list("a", "b"))
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 10)
expect_equal(columns(df), c("a", "b"))
expect_equal(dtypes(df), list(c("a", "int"), c("b", "string")))
- df <- createDataFrame(sqlCtx, rdd)
+ df <- createDataFrame(sqlContext, rdd)
expect_true(inherits(df, "DataFrame"))
expect_equal(columns(df), c("_1", "_2"))
schema <- structType(structField(x = "a", type = "integer", nullable = TRUE),
structField(x = "b", type = "string", nullable = TRUE))
- df <- createDataFrame(sqlCtx, rdd, schema)
+ df <- createDataFrame(sqlContext, rdd, schema)
expect_true(inherits(df, "DataFrame"))
expect_equal(columns(df), c("a", "b"))
expect_equal(dtypes(df), list(c("a", "int"), c("b", "string")))
rdd <- lapply(parallelize(sc, 1:10), function(x) { list(a = x, b = as.character(x)) })
- df <- createDataFrame(sqlCtx, rdd)
+ df <- createDataFrame(sqlContext, rdd)
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 10)
expect_equal(columns(df), c("a", "b"))
@@ -121,17 +121,17 @@ test_that("toDF", {
test_that("create DataFrame from list or data.frame", {
l <- list(list(1, 2), list(3, 4))
- df <- createDataFrame(sqlCtx, l, c("a", "b"))
+ df <- createDataFrame(sqlContext, l, c("a", "b"))
expect_equal(columns(df), c("a", "b"))
l <- list(list(a=1, b=2), list(a=3, b=4))
- df <- createDataFrame(sqlCtx, l)
+ df <- createDataFrame(sqlContext, l)
expect_equal(columns(df), c("a", "b"))
a <- 1:3
b <- c("a", "b", "c")
ldf <- data.frame(a, b)
- df <- createDataFrame(sqlCtx, ldf)
+ df <- createDataFrame(sqlContext, ldf)
expect_equal(columns(df), c("a", "b"))
expect_equal(dtypes(df), list(c("a", "int"), c("b", "string")))
expect_equal(count(df), 3)
@@ -142,7 +142,7 @@ test_that("create DataFrame from list or data.frame", {
test_that("create DataFrame with different data types", {
l <- list(a = 1L, b = 2, c = TRUE, d = "ss", e = as.Date("2012-12-13"),
f = as.POSIXct("2015-03-15 12:13:14.056"))
- df <- createDataFrame(sqlCtx, list(l))
+ df <- createDataFrame(sqlContext, list(l))
expect_equal(dtypes(df), list(c("a", "int"), c("b", "double"), c("c", "boolean"),
c("d", "string"), c("e", "date"), c("f", "timestamp")))
expect_equal(count(df), 1)
@@ -154,7 +154,7 @@ test_that("create DataFrame with different data types", {
# e <- new.env()
# assign("n", 3L, envir = e)
# l <- list(1:10, list("a", "b"), e, list(a="aa", b=3L))
-# df <- createDataFrame(sqlCtx, list(l), c("a", "b", "c", "d"))
+# df <- createDataFrame(sqlContext, list(l), c("a", "b", "c", "d"))
# expect_equal(dtypes(df), list(c("a", "array<int>"), c("b", "array<string>"),
# c("c", "map<string,int>"), c("d", "struct<a:string,b:int>")))
# expect_equal(count(df), 1)
@@ -163,7 +163,7 @@ test_that("create DataFrame with different data types", {
#})
test_that("jsonFile() on a local file returns a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 3)
})
@@ -171,88 +171,88 @@ test_that("jsonFile() on a local file returns a DataFrame", {
test_that("jsonRDD() on a RDD with json string", {
rdd <- parallelize(sc, mockLines)
expect_true(count(rdd) == 3)
- df <- jsonRDD(sqlCtx, rdd)
+ df <- jsonRDD(sqlContext, rdd)
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 3)
rdd2 <- flatMap(rdd, function(x) c(x, x))
- df <- jsonRDD(sqlCtx, rdd2)
+ df <- jsonRDD(sqlContext, rdd2)
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 6)
})
test_that("test cache, uncache and clearCache", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
registerTempTable(df, "table1")
- cacheTable(sqlCtx, "table1")
- uncacheTable(sqlCtx, "table1")
- clearCache(sqlCtx)
- dropTempTable(sqlCtx, "table1")
+ cacheTable(sqlContext, "table1")
+ uncacheTable(sqlContext, "table1")
+ clearCache(sqlContext)
+ dropTempTable(sqlContext, "table1")
})
test_that("test tableNames and tables", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
registerTempTable(df, "table1")
- expect_true(length(tableNames(sqlCtx)) == 1)
- df <- tables(sqlCtx)
+ expect_true(length(tableNames(sqlContext)) == 1)
+ df <- tables(sqlContext)
expect_true(count(df) == 1)
- dropTempTable(sqlCtx, "table1")
+ dropTempTable(sqlContext, "table1")
})
test_that("registerTempTable() results in a queryable table and sql() results in a new DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
registerTempTable(df, "table1")
- newdf <- sql(sqlCtx, "SELECT * FROM table1 where name = 'Michael'")
+ newdf <- sql(sqlContext, "SELECT * FROM table1 where name = 'Michael'")
expect_true(inherits(newdf, "DataFrame"))
expect_true(count(newdf) == 1)
- dropTempTable(sqlCtx, "table1")
+ dropTempTable(sqlContext, "table1")
})
test_that("insertInto() on a registered table", {
- df <- read.df(sqlCtx, jsonPath, "json")
+ df <- read.df(sqlContext, jsonPath, "json")
write.df(df, parquetPath, "parquet", "overwrite")
- dfParquet <- read.df(sqlCtx, parquetPath, "parquet")
+ dfParquet <- read.df(sqlContext, parquetPath, "parquet")
lines <- c("{\"name\":\"Bob\", \"age\":24}",
"{\"name\":\"James\", \"age\":35}")
jsonPath2 <- tempfile(pattern="jsonPath2", fileext=".tmp")
parquetPath2 <- tempfile(pattern = "parquetPath2", fileext = ".parquet")
writeLines(lines, jsonPath2)
- df2 <- read.df(sqlCtx, jsonPath2, "json")
+ df2 <- read.df(sqlContext, jsonPath2, "json")
write.df(df2, parquetPath2, "parquet", "overwrite")
- dfParquet2 <- read.df(sqlCtx, parquetPath2, "parquet")
+ dfParquet2 <- read.df(sqlContext, parquetPath2, "parquet")
registerTempTable(dfParquet, "table1")
insertInto(dfParquet2, "table1")
- expect_true(count(sql(sqlCtx, "select * from table1")) == 5)
- expect_true(first(sql(sqlCtx, "select * from table1 order by age"))$name == "Michael")
- dropTempTable(sqlCtx, "table1")
+ expect_true(count(sql(sqlContext, "select * from table1")) == 5)
+ expect_true(first(sql(sqlContext, "select * from table1 order by age"))$name == "Michael")
+ dropTempTable(sqlContext, "table1")
registerTempTable(dfParquet, "table1")
insertInto(dfParquet2, "table1", overwrite = TRUE)
- expect_true(count(sql(sqlCtx, "select * from table1")) == 2)
- expect_true(first(sql(sqlCtx, "select * from table1 order by age"))$name == "Bob")
- dropTempTable(sqlCtx, "table1")
+ expect_true(count(sql(sqlContext, "select * from table1")) == 2)
+ expect_true(first(sql(sqlContext, "select * from table1 order by age"))$name == "Bob")
+ dropTempTable(sqlContext, "table1")
})
test_that("table() returns a new DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
registerTempTable(df, "table1")
- tabledf <- table(sqlCtx, "table1")
+ tabledf <- table(sqlContext, "table1")
expect_true(inherits(tabledf, "DataFrame"))
expect_true(count(tabledf) == 3)
- dropTempTable(sqlCtx, "table1")
+ dropTempTable(sqlContext, "table1")
})
test_that("toRDD() returns an RRDD", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
testRDD <- toRDD(df)
expect_true(inherits(testRDD, "RDD"))
expect_true(count(testRDD) == 3)
})
test_that("union on two RDDs created from DataFrames returns an RRDD", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
RDD1 <- toRDD(df)
RDD2 <- toRDD(df)
unioned <- unionRDD(RDD1, RDD2)
@@ -274,7 +274,7 @@ test_that("union on mixed serialization types correctly returns a byte RRDD", {
writeLines(textLines, textPath)
textRDD <- textFile(sc, textPath)
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
dfRDD <- toRDD(df)
unionByte <- unionRDD(rdd, dfRDD)
@@ -292,7 +292,7 @@ test_that("union on mixed serialization types correctly returns a byte RRDD", {
test_that("objectFile() works with row serialization", {
objectPath <- tempfile(pattern="spark-test", fileext=".tmp")
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
dfRDD <- toRDD(df)
saveAsObjectFile(coalesce(dfRDD, 1L), objectPath)
objectIn <- objectFile(sc, objectPath)
@@ -303,7 +303,7 @@ test_that("objectFile() works with row serialization", {
})
test_that("lapply() on a DataFrame returns an RDD with the correct columns", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
testRDD <- lapply(df, function(row) {
row$newCol <- row$age + 5
row
@@ -315,7 +315,7 @@ test_that("lapply() on a DataFrame returns an RDD with the correct columns", {
})
test_that("collect() returns a data.frame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
rdf <- collect(df)
expect_true(is.data.frame(rdf))
expect_true(names(rdf)[1] == "age")
@@ -324,20 +324,20 @@ test_that("collect() returns a data.frame", {
})
test_that("limit() returns DataFrame with the correct number of rows", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
dfLimited <- limit(df, 2)
expect_true(inherits(dfLimited, "DataFrame"))
expect_true(count(dfLimited) == 2)
})
test_that("collect() and take() on a DataFrame return the same number of rows and columns", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
expect_true(nrow(collect(df)) == nrow(take(df, 10)))
expect_true(ncol(collect(df)) == ncol(take(df, 10)))
})
test_that("multiple pipeline transformations starting with a DataFrame result in an RDD with the correct values", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
first <- lapply(df, function(row) {
row$age <- row$age + 5
row
@@ -354,7 +354,7 @@ test_that("multiple pipeline transformations starting with a DataFrame result in
})
test_that("cache(), persist(), and unpersist() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
expect_false(df@env$isCached)
cache(df)
expect_true(df@env$isCached)
@@ -373,7 +373,7 @@ test_that("cache(), persist(), and unpersist() on a DataFrame", {
})
test_that("schema(), dtypes(), columns(), names() return the correct values/format", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
testSchema <- schema(df)
expect_true(length(testSchema$fields()) == 2)
expect_true(testSchema$fields()[[1]]$dataType.toString() == "LongType")
@@ -394,7 +394,7 @@ test_that("schema(), dtypes(), columns(), names() return the correct values/form
})
test_that("head() and first() return the correct data", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
testHead <- head(df)
expect_true(nrow(testHead) == 3)
expect_true(ncol(testHead) == 2)
@@ -415,14 +415,14 @@ test_that("distinct() on DataFrames", {
jsonPathWithDup <- tempfile(pattern="sparkr-test", fileext=".tmp")
writeLines(lines, jsonPathWithDup)
- df <- jsonFile(sqlCtx, jsonPathWithDup)
+ df <- jsonFile(sqlContext, jsonPathWithDup)
uniques <- distinct(df)
expect_true(inherits(uniques, "DataFrame"))
expect_true(count(uniques) == 3)
})
test_that("sample on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
sampled <- sample(df, FALSE, 1.0)
expect_equal(nrow(collect(sampled)), count(df))
expect_true(inherits(sampled, "DataFrame"))
@@ -435,7 +435,7 @@ test_that("sample on a DataFrame", {
})
test_that("select operators", {
- df <- select(jsonFile(sqlCtx, jsonPath), "name", "age")
+ df <- select(jsonFile(sqlContext, jsonPath), "name", "age")
expect_true(inherits(df$name, "Column"))
expect_true(inherits(df[[2]], "Column"))
expect_true(inherits(df[["age"]], "Column"))
@@ -461,7 +461,7 @@ test_that("select operators", {
})
test_that("select with column", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
df1 <- select(df, "name")
expect_true(columns(df1) == c("name"))
expect_true(count(df1) == 3)
@@ -472,7 +472,7 @@ test_that("select with column", {
})
test_that("selectExpr() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
selected <- selectExpr(df, "age * 2")
expect_true(names(selected) == "(age * 2)")
expect_equal(collect(selected), collect(select(df, df$age * 2L)))
@@ -483,7 +483,7 @@ test_that("selectExpr() on a DataFrame", {
})
test_that("column calculation", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
d <- collect(select(df, alias(df$age + 1, "age2")))
expect_true(names(d) == c("age2"))
df2 <- select(df, lower(df$name), abs(df$age))
@@ -492,15 +492,15 @@ test_that("column calculation", {
})
test_that("read.df() from json file", {
- df <- read.df(sqlCtx, jsonPath, "json")
+ df <- read.df(sqlContext, jsonPath, "json")
expect_true(inherits(df, "DataFrame"))
expect_true(count(df) == 3)
})
test_that("write.df() as parquet file", {
- df <- read.df(sqlCtx, jsonPath, "json")
+ df <- read.df(sqlContext, jsonPath, "json")
write.df(df, parquetPath, "parquet", mode="overwrite")
- df2 <- read.df(sqlCtx, parquetPath, "parquet")
+ df2 <- read.df(sqlContext, parquetPath, "parquet")
expect_true(inherits(df2, "DataFrame"))
expect_true(count(df2) == 3)
})
@@ -553,7 +553,7 @@ test_that("column binary mathfunctions", {
"{\"a\":4, \"b\":8}")
jsonPathWithDup <- tempfile(pattern="sparkr-test", fileext=".tmp")
writeLines(lines, jsonPathWithDup)
- df <- jsonFile(sqlCtx, jsonPathWithDup)
+ df <- jsonFile(sqlContext, jsonPathWithDup)
expect_equal(collect(select(df, atan2(df$a, df$b)))[1, "ATAN2(a, b)"], atan2(1, 5))
expect_equal(collect(select(df, atan2(df$a, df$b)))[2, "ATAN2(a, b)"], atan2(2, 6))
expect_equal(collect(select(df, atan2(df$a, df$b)))[3, "ATAN2(a, b)"], atan2(3, 7))
@@ -565,7 +565,7 @@ test_that("column binary mathfunctions", {
})
test_that("string operators", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
expect_equal(count(where(df, like(df$name, "A%"))), 1)
expect_equal(count(where(df, startsWith(df$name, "A"))), 1)
expect_equal(first(select(df, substr(df$name, 1, 2)))[[1]], "Mi")
@@ -573,7 +573,7 @@ test_that("string operators", {
})
test_that("group by", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
df1 <- agg(df, name = "max", age = "sum")
expect_true(1 == count(df1))
df1 <- agg(df, age2 = max(df$age))
@@ -610,7 +610,7 @@ test_that("group by", {
})
test_that("arrange() and orderBy() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
sorted <- arrange(df, df$age)
expect_true(collect(sorted)[1,2] == "Michael")
@@ -627,7 +627,7 @@ test_that("arrange() and orderBy() on a DataFrame", {
})
test_that("filter() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
filtered <- filter(df, "age > 20")
expect_true(count(filtered) == 1)
expect_true(collect(filtered)$name == "Andy")
@@ -637,7 +637,7 @@ test_that("filter() on a DataFrame", {
})
test_that("join() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
mockLines2 <- c("{\"name\":\"Michael\", \"test\": \"yes\"}",
"{\"name\":\"Andy\", \"test\": \"no\"}",
@@ -645,7 +645,7 @@ test_that("join() on a DataFrame", {
"{\"name\":\"Bob\", \"test\": \"yes\"}")
jsonPath2 <- tempfile(pattern="sparkr-test", fileext=".tmp")
writeLines(mockLines2, jsonPath2)
- df2 <- jsonFile(sqlCtx, jsonPath2)
+ df2 <- jsonFile(sqlContext, jsonPath2)
joined <- join(df, df2)
expect_equal(names(joined), c("age", "name", "name", "test"))
@@ -668,7 +668,7 @@ test_that("join() on a DataFrame", {
})
test_that("toJSON() returns an RDD of the correct values", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
testRDD <- toJSON(df)
expect_true(inherits(testRDD, "RDD"))
expect_true(SparkR:::getSerializedMode(testRDD) == "string")
@@ -676,25 +676,25 @@ test_that("toJSON() returns an RDD of the correct values", {
})
test_that("showDF()", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
s <- capture.output(showDF(df))
expect_output(s , "+----+-------+\n| age| name|\n+----+-------+\n|null|Michael|\n| 30| Andy|\n| 19| Justin|\n+----+-------+\n")
})
test_that("isLocal()", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
expect_false(isLocal(df))
})
test_that("unionAll(), except(), and intersect() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
lines <- c("{\"name\":\"Bob\", \"age\":24}",
"{\"name\":\"Andy\", \"age\":30}",
"{\"name\":\"James\", \"age\":35}")
jsonPath2 <- tempfile(pattern="sparkr-test", fileext=".tmp")
writeLines(lines, jsonPath2)
- df2 <- read.df(sqlCtx, jsonPath2, "json")
+ df2 <- read.df(sqlContext, jsonPath2, "json")
unioned <- arrange(unionAll(df, df2), df$age)
expect_true(inherits(unioned, "DataFrame"))
@@ -713,7 +713,7 @@ test_that("unionAll(), except(), and intersect() on a DataFrame", {
})
test_that("withColumn() and withColumnRenamed()", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
newDF <- withColumn(df, "newAge", df$age + 2)
expect_true(length(columns(newDF)) == 3)
expect_true(columns(newDF)[3] == "newAge")
@@ -725,7 +725,7 @@ test_that("withColumn() and withColumnRenamed()", {
})
test_that("mutate() and rename()", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
newDF <- mutate(df, newAge = df$age + 2)
expect_true(length(columns(newDF)) == 3)
expect_true(columns(newDF)[3] == "newAge")
@@ -737,25 +737,25 @@ test_that("mutate() and rename()", {
})
test_that("write.df() on DataFrame and works with parquetFile", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
write.df(df, parquetPath, "parquet", mode="overwrite")
- parquetDF <- parquetFile(sqlCtx, parquetPath)
+ parquetDF <- parquetFile(sqlContext, parquetPath)
expect_true(inherits(parquetDF, "DataFrame"))
expect_equal(count(df), count(parquetDF))
})
test_that("parquetFile works with multiple input paths", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
write.df(df, parquetPath, "parquet", mode="overwrite")
parquetPath2 <- tempfile(pattern = "parquetPath2", fileext = ".parquet")
write.df(df, parquetPath2, "parquet", mode="overwrite")
- parquetDF <- parquetFile(sqlCtx, parquetPath, parquetPath2)
+ parquetDF <- parquetFile(sqlContext, parquetPath, parquetPath2)
expect_true(inherits(parquetDF, "DataFrame"))
expect_true(count(parquetDF) == count(df)*2)
})
test_that("describe() on a DataFrame", {
- df <- jsonFile(sqlCtx, jsonPath)
+ df <- jsonFile(sqlContext, jsonPath)
stats <- describe(df, "age")
expect_equal(collect(stats)[1, "summary"], "count")
expect_equal(collect(stats)[2, "age"], "24.5")