Skip to content

Commit e14d2cf

Browse files
Fix DescribeDeltaHistorySuite tests for DESCRIBE HISTORY
GitOrigin-RevId: ecd9c7204e4000526db1aaf0e220d1db38a67887
1 parent a57465a commit e14d2cf

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

spark/src/test/scala/org/apache/spark/sql/delta/DescribeDeltaHistorySuite.scala

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,15 @@ trait DescribeDeltaHistorySuiteBase
224224
val e = intercept[AnalysisException] {
225225
sql(s"DESCRIBE HISTORY $viewName").collect()
226226
}
227-
assert(e.getMessage.contains("spark_catalog.default.delta_view is a view. " +
228-
"'DESCRIBE HISTORY' expects a table"))
227+
// Error message varies slightly between Spark versions because Spark 3.5 still uses
228+
// QueryCompilationErrors.expectTableNotViewError instead of
229+
// QueryCompilationErrors.unsupportedViewOperationError
230+
assert(
231+
e.getMessage.contains( // 3.5
232+
"spark_catalog.default.delta_view is a view. 'DESCRIBE HISTORY' expects a table") ||
233+
e.getMessage.contains( // 4.0
234+
"'DESCRIBE HISTORY' expects a table but `spark_catalog`.`default`.`delta_view` is a view")
235+
)
229236
}
230237
}
231238

@@ -238,7 +245,15 @@ trait DescribeDeltaHistorySuiteBase
238245
val e = intercept[AnalysisException] {
239246
sql(s"DESCRIBE HISTORY $viewName").collect()
240247
}
241-
assert(e.getMessage.contains("v is a temp view. 'DESCRIBE HISTORY' expects a table"))
248+
// Error message varies slightly between Spark versions because Spark 3.5 still uses
249+
// QueryCompilationErrors.expectTableNotViewError instead of
250+
// QueryCompilationErrors.unsupportedViewOperationError
251+
assert(
252+
e.getMessage.contains( // 3.5
253+
"v is a temp view. 'DESCRIBE HISTORY' expects a table") ||
254+
e.getMessage.contains( // 4.0
255+
"'DESCRIBE HISTORY' expects a table but `v` is a view")
256+
)
242257
}
243258
}
244259

0 commit comments

Comments
 (0)