diff --git a/connector/connect/common/src/test/resources/query-tests/explain-results/function_base64.explain b/connector/connect/common/src/test/resources/query-tests/explain-results/function_base64.explain index 99d842189c65..3b4e69469c30 100644 --- a/connector/connect/common/src/test/resources/query-tests/explain-results/function_base64.explain +++ b/connector/connect/common/src/test/resources/query-tests/explain-results/function_base64.explain @@ -1,2 +1,2 @@ -Project [staticinvoke(class org.apache.spark.sql.catalyst.expressions.Base64, StringType, encode, cast(g#0 as binary), false, BinaryType, BooleanType, true, true, true) AS base64(g)#0] +Project [staticinvoke(class org.apache.spark.sql.catalyst.expressions.Base64, StringType, encode, cast(g#0 as binary), true, BinaryType, BooleanType, true, true, true) AS base64(g)#0] +- LocalRelation , [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala index 55f80645228d..44c58cd13ea8 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala @@ -3229,14 +3229,13 @@ object SQLConf { .booleanConf .createWithDefault(false) - val CHUNK_BASE64_STRING_ENABLED = buildConf("spark.sql.legacy.chunkBase64String.enabled") - .internal() + val CHUNK_BASE64_STRING_ENABLED = buildConf("spark.sql.chunkBase64String.enabled") .doc("Whether to truncate string generated by the `Base64` function. When true, base64" + " strings generated by the base64 function are chunked into lines of at most 76" + " characters. When false, the base64 strings are not chunked.") .version("3.5.2") .booleanConf - .createWithDefault(false) + .createWithDefault(true) val ENABLE_DEFAULT_COLUMNS = buildConf("spark.sql.defaultColumn.enabled") diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/StringExpressionsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/StringExpressionsSuite.scala index 75224bf33f53..c17268838368 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/StringExpressionsSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/StringExpressionsSuite.scala @@ -517,6 +517,10 @@ class StringExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper { withSQLConf(SQLConf.CHUNK_BASE64_STRING_ENABLED.key -> "true") { checkEvaluation(Base64(Literal(longString.getBytes)), chunkEncoded) } + + // check if unbase64 works well for chunked and non-chunked encoded strings + checkEvaluation(StringDecode(UnBase64(Literal(encoded)), Literal("utf-8")), longString) + checkEvaluation(StringDecode(UnBase64(Literal(chunkEncoded)), Literal("utf-8")), longString) } test("initcap unit test") {