Skip to content

Commit a053b40

Browse files
committed
[SPARK-47099][SQL][FOLLOW-UP] Uses ordinalNumber in UNEXPECTED_INPUT_TYPE
### What changes were proposed in this pull request? This PR is a followup of #45177 that fixes some leftovers missed. ### Why are the changes needed? For consistency. Also, I think this fixes the Maven build failure: https://github.com/apache/spark/actions/runs/8005710953/job/21865798408 ### Does this PR introduce _any_ user-facing change? Yes, the value of 'paramIndex' for the error class `UNEXPECTED-INPUT-TYPE` is uniformly set by `ordinalNumber`. ### How was this patch tested? CI in this PR. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #45225 from HyukjinKwon/SPARK-47099-followup. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 511839b commit a053b40

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
19661966
new AnalysisException(
19671967
errorClass = "UNEXPECTED_INPUT_TYPE",
19681968
messageParameters = Map(
1969-
"paramIndex" -> paramIndex.toString,
1969+
"paramIndex" -> ordinalNumber(paramIndex - 1),
19701970
"functionName" -> toSQLId(functionName),
19711971
"requiredType" -> toSQLType(dataType),
19721972
"inputSql" -> toSQLExpr(expression),

sql/core/src/test/resources/sql-tests/analyzer-results/mode.sql.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ org.apache.spark.sql.AnalysisException
124124
"functionName" : "`mode`",
125125
"inputSql" : "\"true\"",
126126
"inputType" : "\"STRING\"",
127-
"paramIndex" : "2",
127+
"paramIndex" : "second",
128128
"requiredType" : "\"BOOLEAN\""
129129
},
130130
"queryContext" : [ {

sql/core/src/test/resources/sql-tests/analyzer-results/table-valued-functions.sql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ org.apache.spark.sql.AnalysisException
8181
"functionName" : "`range`",
8282
"inputSql" : "\"NULL\"",
8383
"inputType" : "\"VOID\"",
84-
"paramIndex" : "2",
84+
"paramIndex" : "second",
8585
"requiredType" : "\"BIGINT\""
8686
},
8787
"queryContext" : [ {
@@ -105,7 +105,7 @@ org.apache.spark.sql.AnalysisException
105105
"functionName" : "`range`",
106106
"inputSql" : "\"array(1, 2, 3)\"",
107107
"inputType" : "\"ARRAY<INT>\"",
108-
"paramIndex" : "2",
108+
"paramIndex" : "second",
109109
"requiredType" : "\"BIGINT\""
110110
},
111111
"queryContext" : [ {

sql/core/src/test/resources/sql-tests/results/mode.sql.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ org.apache.spark.sql.AnalysisException
103103
"functionName" : "`mode`",
104104
"inputSql" : "\"true\"",
105105
"inputType" : "\"STRING\"",
106-
"paramIndex" : "2",
106+
"paramIndex" : "second",
107107
"requiredType" : "\"BOOLEAN\""
108108
},
109109
"queryContext" : [ {

sql/core/src/test/resources/sql-tests/results/table-valued-functions.sql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ org.apache.spark.sql.AnalysisException
112112
"functionName" : "`range`",
113113
"inputSql" : "\"NULL\"",
114114
"inputType" : "\"VOID\"",
115-
"paramIndex" : "2",
115+
"paramIndex" : "second",
116116
"requiredType" : "\"BIGINT\""
117117
},
118118
"queryContext" : [ {
@@ -138,7 +138,7 @@ org.apache.spark.sql.AnalysisException
138138
"functionName" : "`range`",
139139
"inputSql" : "\"array(1, 2, 3)\"",
140140
"inputType" : "\"ARRAY<INT>\"",
141-
"paramIndex" : "2",
141+
"paramIndex" : "second",
142142
"requiredType" : "\"BIGINT\""
143143
},
144144
"queryContext" : [ {

sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class CollationSuite extends QueryTest with SharedSparkSession {
8080
sqlState = "42K09",
8181
Map(
8282
"functionName" -> "`collate`",
83-
"paramIndex" -> "1",
83+
"paramIndex" -> "first",
8484
"inputSql" -> "\"123\"",
8585
"inputType" -> "\"INT\"",
8686
"requiredType" -> "\"STRING\""),

0 commit comments

Comments
 (0)