@@ -209,18 +209,18 @@ test_that("registerTempTable() results in a queryable table and sql() results in
209209})
210210
211211test_that(" insertInto() on a registered table" , {
212- df <- loadDF (sqlCtx , jsonPath , " json" )
213- saveDF (df , parquetPath , " parquet" , " overwrite" )
214- dfParquet <- loadDF (sqlCtx , parquetPath , " parquet" )
212+ df <- read.df (sqlCtx , jsonPath , " json" )
213+ write.df (df , parquetPath , " parquet" , " overwrite" )
214+ dfParquet <- read.df (sqlCtx , parquetPath , " parquet" )
215215
216216 lines <- c(" {\" name\" :\" Bob\" , \" age\" :24}" ,
217217 " {\" name\" :\" James\" , \" age\" :35}" )
218218 jsonPath2 <- tempfile(pattern = " jsonPath2" , fileext = " .tmp" )
219219 parquetPath2 <- tempfile(pattern = " parquetPath2" , fileext = " .parquet" )
220220 writeLines(lines , jsonPath2 )
221- df2 <- loadDF (sqlCtx , jsonPath2 , " json" )
222- saveDF (df2 , parquetPath2 , " parquet" , " overwrite" )
223- dfParquet2 <- loadDF (sqlCtx , parquetPath2 , " parquet" )
221+ df2 <- read.df (sqlCtx , jsonPath2 , " json" )
222+ write.df (df2 , parquetPath2 , " parquet" , " overwrite" )
223+ dfParquet2 <- read.df (sqlCtx , parquetPath2 , " parquet" )
224224
225225 registerTempTable(dfParquet , " table1" )
226226 insertInto(dfParquet2 , " table1" )
@@ -421,12 +421,12 @@ test_that("distinct() on DataFrames", {
421421 expect_true(count(uniques ) == 3 )
422422})
423423
424- test_that(" sampleDF on a DataFrame" , {
424+ test_that(" sample on a DataFrame" , {
425425 df <- jsonFile(sqlCtx , jsonPath )
426- sampled <- sampleDF (df , FALSE , 1.0 )
426+ sampled <- sample (df , FALSE , 1.0 )
427427 expect_equal(nrow(collect(sampled )), count(df ))
428428 expect_true(inherits(sampled , " DataFrame" ))
429- sampled2 <- sampleDF (df , FALSE , 0.1 )
429+ sampled2 <- sample (df , FALSE , 0.1 )
430430 expect_true(count(sampled2 ) < 3 )
431431
432432 # Also test sample_frac
@@ -491,16 +491,16 @@ test_that("column calculation", {
491491 expect_true(count(df2 ) == 3 )
492492})
493493
494- test_that(" load () from json file" , {
495- df <- loadDF (sqlCtx , jsonPath , " json" )
494+ test_that(" read.df () from json file" , {
495+ df <- read.df (sqlCtx , jsonPath , " json" )
496496 expect_true(inherits(df , " DataFrame" ))
497497 expect_true(count(df ) == 3 )
498498})
499499
500- test_that(" save () as parquet file" , {
501- df <- loadDF (sqlCtx , jsonPath , " json" )
502- saveDF (df , parquetPath , " parquet" , mode = " overwrite" )
503- df2 <- loadDF (sqlCtx , parquetPath , " parquet" )
500+ test_that(" write.df () as parquet file" , {
501+ df <- read.df (sqlCtx , jsonPath , " json" )
502+ write.df (df , parquetPath , " parquet" , mode = " overwrite" )
503+ df2 <- read.df (sqlCtx , parquetPath , " parquet" )
504504 expect_true(inherits(df2 , " DataFrame" ))
505505 expect_true(count(df2 ) == 3 )
506506})
@@ -670,7 +670,7 @@ test_that("unionAll(), except(), and intersect() on a DataFrame", {
670670 " {\" name\" :\" James\" , \" age\" :35}" )
671671 jsonPath2 <- tempfile(pattern = " sparkr-test" , fileext = " .tmp" )
672672 writeLines(lines , jsonPath2 )
673- df2 <- loadDF (sqlCtx , jsonPath2 , " json" )
673+ df2 <- read.df (sqlCtx , jsonPath2 , " json" )
674674
675675 unioned <- arrange(unionAll(df , df2 ), df $ age )
676676 expect_true(inherits(unioned , " DataFrame" ))
@@ -712,19 +712,19 @@ test_that("mutate() and rename()", {
712712 expect_true(columns(newDF2 )[1 ] == " newerAge" )
713713})
714714
715- test_that(" saveDF () on DataFrame and works with parquetFile" , {
715+ test_that(" write.df () on DataFrame and works with parquetFile" , {
716716 df <- jsonFile(sqlCtx , jsonPath )
717- saveDF (df , parquetPath , " parquet" , mode = " overwrite" )
717+ write.df (df , parquetPath , " parquet" , mode = " overwrite" )
718718 parquetDF <- parquetFile(sqlCtx , parquetPath )
719719 expect_true(inherits(parquetDF , " DataFrame" ))
720720 expect_equal(count(df ), count(parquetDF ))
721721})
722722
723723test_that(" parquetFile works with multiple input paths" , {
724724 df <- jsonFile(sqlCtx , jsonPath )
725- saveDF (df , parquetPath , " parquet" , mode = " overwrite" )
725+ write.df (df , parquetPath , " parquet" , mode = " overwrite" )
726726 parquetPath2 <- tempfile(pattern = " parquetPath2" , fileext = " .parquet" )
727- saveDF (df , parquetPath2 , " parquet" , mode = " overwrite" )
727+ write.df (df , parquetPath2 , " parquet" , mode = " overwrite" )
728728 parquetDF <- parquetFile(sqlCtx , parquetPath , parquetPath2 )
729729 expect_true(inherits(parquetDF , " DataFrame" ))
730730 expect_true(count(parquetDF ) == count(df )* 2 )
0 commit comments