MaxGekk commented on code in PR #39839:
URL: https://github.com/apache/spark/pull/39839#discussion_r1095675824
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala:
##########
@@ -955,30 +955,65 @@ class AnalysisSuite extends AnalysisTest with Matchers {
val r4 = Except(firstTable, secondTable, isAll = false)
val r5 = Intersect(firstTable, secondTable, isAll = false)
- assertAnalysisError(r1,
- Seq("Union can only be performed on tables with compatible column types.
" +
- "The second column of the second table is timestamp type which is not
compatible " +
- "with double at the same column of the first table"))
-
- assertAnalysisError(r2,
- Seq("Union can only be performed on tables with compatible column types.
" +
- "The third column of the second table is timestamp type which is not
compatible " +
- "with int at the same column of the first table"))
-
- assertAnalysisError(r3,
- Seq("Union can only be performed on tables with compatible column types.
" +
- "The 4th column of the second table is timestamp type which is not
compatible " +
- "with float at the same column of the first table"))
-
- assertAnalysisError(r4,
- Seq("Except can only be performed on tables with compatible column
types. " +
- "The second column of the second table is timestamp type which is not
compatible " +
- "with double at the same column of the first table"))
-
- assertAnalysisError(r5,
- Seq("Intersect can only be performed on tables with compatible column
types. " +
- "The second column of the second table is timestamp type which is not
compatible " +
- "with double at the same column of the first table"))
+ assertAnalysisErrorClass(
+ r1,
Review Comment:
nit: just inline `r1` since it is used only once. (the same for r2..r5).
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -570,13 +570,13 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog with QueryErrorsB
// SPARK-18058: we shall not care about the nullability of
columns
if (!dataTypesAreCompatibleFn(dt1, dt2)) {
e.failAnalysis(
- errorClass = "_LEGACY_ERROR_TEMP_2430",
+ errorClass = "INCOMPATIBLE_COLUMN_TYPE",
messageParameters = Map(
"operator" -> toSQLStmt(operator.nodeName),
- "ci" -> ordinalNumber(ci),
- "ti" -> ordinalNumber(ti + 1),
- "dt1" -> dt1.catalogString,
- "dt2" -> dt2.catalogString,
+ "columnOrdinalNumber" -> ordinalNumber(ci),
+ "tableOrdinalNumber" -> ordinalNumber(ti + 1),
+ "dataType1" -> toSQLType(dt1.catalogString),
+ "dataType2" -> toSQLType(dt2.catalogString),
Review Comment:
Please, don't form the type strings yourself via `catalogString()`. Use
`toSQLType()` which invokes `sql()`:
```suggestion
"dataType1" -> toSQLType(dt1),
"dataType2" -> toSQLType(dt2),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]