From f6b497fcdddc705a9e1022e20b0dbc15da1b5a5a Mon Sep 17 00:00:00 2001 From: Prashant Sharma Date: Tue, 28 Jun 2016 17:11:06 +0530 Subject: [SPARK-16128][SQL] Allow setting length of characters to be truncated to, in Dataset.show function. ## What changes were proposed in this pull request? Allowing truncate to a specific number of character is convenient at times, especially while operating from the REPL. Sometimes those last few characters make all the difference, and showing everything brings in whole lot of noise. ## How was this patch tested? Existing tests. + 1 new test in DataFrameSuite. For SparkR and pyspark, existing tests and manual testing. Author: Prashant Sharma Author: Prashant Sharma Closes #13839 from ScrapCodes/add_truncateTo_DF.show. --- R/pkg/inst/tests/testthat/test_sparkSQL.R | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'R/pkg/inst') diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R index 74def5ce42..7562fa95e3 100644 --- a/R/pkg/inst/tests/testthat/test_sparkSQL.R +++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R @@ -1582,7 +1582,15 @@ test_that("showDF()", { "| 30| Andy|\n", "| 19| Justin|\n", "+----+-------+\n", sep = "") + expected2 <- paste("+---+----+\n", + "|age|name|\n", + "+---+----+\n", + "|nul| Mic|\n", + "| 30| And|\n", + "| 19| Jus|\n", + "+---+----+\n", sep = "") expect_output(showDF(df), expected) + expect_output(showDF(df, truncate = 3), expected2) }) test_that("isLocal()", { -- cgit v1.2.3