@@ -1493,6 +1493,27 @@ test_that("read/write Parquet files", {
14931493 unlink(parquetPath4 )
14941494})
14951495
1496+ test_that(" read/write text files" , {
1497+ # Test write.df and read.df
1498+ df <- read.df(sqlContext , jsonPath , " text" )
1499+ expect_is(df , " DataFrame" )
1500+ expect_equal(colnames(df ), c(" value" ))
1501+ expect_equal(count(df ), 3 )
1502+ textPath <- tempfile(pattern = " textPath" , fileext = " .txt" )
1503+ write.df(df , textPath , " text" , mode = " overwrite" )
1504+
1505+ # Test write.text and read.text
1506+ textPath2 <- tempfile(pattern = " textPath2" , fileext = " .txt" )
1507+ write.text(df , textPath2 )
1508+ df2 <- read.text(sqlContext , c(textPath , textPath2 ))
1509+ expect_is(df2 , " DataFrame" )
1510+ expect_equal(colnames(df2 ), c(" value" ))
1511+ expect_equal(count(df2 ), count(df ) * 2 )
1512+
1513+ unlink(textPath )
1514+ unlink(textPath2 )
1515+ })
1516+
14961517test_that(" describe() and summarize() on a DataFrame" , {
14971518 df <- read.json(sqlContext , jsonPath )
14981519 stats <- describe(df , " age" )
0 commit comments