Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Project [static_invoke(Base64.encode(cast(g#0 as binary), false)) AS base64(CAST(g AS BINARY))#0]
Project [static_invoke(Base64.encode(cast(g#0 as binary), true)) AS base64(CAST(g AS BINARY))#0]
+- LocalRelation <empty>, [id#0L, a#0, b#0, d#0, e#0, f#0, g#0]
Original file line number Diff line number Diff line change
Expand Up @@ -3525,14 +3525,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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this case to confirm that the chunkEncoded string can be decoded correctly. cc @cloud-fan

}

test("initcap unit test") {
Expand Down