-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-48658][SQL] Encode/Decode functions report coding errors instead of mojibake for unmappable characters #47017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
6426fdd
aee78a5
afb2d08
f6dd4fa
851135c
d3473a4
3e90976
b0cf6ee
64f3c39
9d2583c
8f5a236
d7a4199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| Project [decode(cast(g#0 as binary), UTF-8, false) AS decode(g, UTF-8)#0] | ||
| Project [staticinvoke(class org.apache.spark.sql.catalyst.expressions.StringDecode, StringType, decode, cast(g#0 as binary), UTF-8, false, false, BinaryType, StringTypeAnyCollation, BooleanType, BooleanType, true, true, true) AS decode(g, UTF-8)#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 |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| Project [encode(g#0, UTF-8, false) AS encode(g, UTF-8)#0] | ||
| Project [staticinvoke(class org.apache.spark.sql.catalyst.expressions.Encode, BinaryType, encode, g#0, UTF-8, false, false, StringTypeAnyCollation, StringTypeAnyCollation, BooleanType, BooleanType, true, true, true) AS encode(g, UTF-8)#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 |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| Project [encode(g#0, UTF-8, false) AS to_binary(g, utf-8)#0] | ||
| Project [staticinvoke(class org.apache.spark.sql.catalyst.expressions.Encode, BinaryType, encode, g#0, UTF-8, false, false, StringTypeAnyCollation, StringTypeAnyCollation, BooleanType, BooleanType, true, true, true) AS to_binary(g, utf-8)#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 |
|---|---|---|
|
|
@@ -107,7 +107,7 @@ class CodeGenerationSuite extends SparkFunSuite with ExpressionEvalHelper { | |
| strExpr = StringDecode(Encode(strExpr, "utf-8"), "utf-8") | ||
|
||
| } | ||
|
|
||
| val expressions = Seq(If(EqualTo(strExpr, strExpr), strExpr, strExpr)) | ||
| val expressions = Seq(If(EqualTo(strExpr, strExpr), strExpr, strExpr)).map(replace) | ||
| val plan = GenerateMutableProjection.generate(expressions) | ||
| val actual = plan(null).toSeq(expressions.map(_.dataType)) | ||
| assert(actual.length == 1) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it should be a fallback conf to ANSI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasons I'd like to make it independent of ANSI are:
The reasons mentioned above indicate that this behavior is more of a legacy trait of Spark itself.