Skip to content
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

[SPARK-40420][SQL] Sort error message parameters by names in the JSON formats #37875

Closed
wants to merge 3 commits into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -203,7 +203,7 @@ private[spark] object SparkThrowableHelper {
val parameterNames = e.getParameterNames
if (!parameterNames.isEmpty) {
g.writeObjectFieldStart("messageParameters")
(parameterNames zip e.getMessageParameters).foreach { case (name, value) =>
(parameterNames zip e.getMessageParameters).sortBy(_._1).foreach { case (name, value) =>
g.writeStringField(name, value)
}
g.writeEndObject()
Expand Down
28 changes: 14 additions & 14 deletions sql/core/src/test/resources/sql-tests/results/ansi/array.sql.out
Expand Up @@ -168,9 +168,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX_IN_ELEMENT_AT",
"messageParameters" : {
"indexValue" : "5",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "3",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "5"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -191,9 +191,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX_IN_ELEMENT_AT",
"messageParameters" : {
"indexValue" : "-5",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "3",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "-5"
},
"queryContext" : [ {
"objectType" : "",
Expand Down Expand Up @@ -232,9 +232,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX",
"messageParameters" : {
"indexValue" : "4",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "2",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "4"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -255,9 +255,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX",
"messageParameters" : {
"indexValue" : "0",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "2",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "0"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -278,9 +278,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX",
"messageParameters" : {
"indexValue" : "-1",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "2",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "-1"
},
"queryContext" : [ {
"objectType" : "",
Expand Down Expand Up @@ -333,9 +333,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX",
"messageParameters" : {
"indexValue" : "5",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "3",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "5"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -356,9 +356,9 @@ org.apache.spark.SparkArrayIndexOutOfBoundsException
{
"errorClass" : "INVALID_ARRAY_INDEX",
"messageParameters" : {
"indexValue" : "-1",
"ansiConfig" : "\"spark.sql.ansi.enabled\"",
"arraySize" : "3",
"ansiConfig" : "\"spark.sql.ansi.enabled\""
"indexValue" : "-1"
},
"queryContext" : [ {
"objectType" : "",
Expand Down