Skip to content

Commit 2f542ff

Browse files
committed
fix test failed
1 parent 0b9dc3a commit 2f542ff

File tree

1 file changed

+9
-5
lines changed
  • sql/core/src/main/scala/org/apache/spark/sql/execution/datasources

1 file changed

+9
-5
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,21 @@ case class AnalyzeCreateTable(sparkSession: SparkSession) extends Rule[LogicalPl
112112
throw new AnalysisException("Saving data into a view is not allowed.")
113113
}
114114

115-
val (existingProvider, specifiedProvider) = DDLUtils.isHiveTable(existingTable) match {
115+
val (isProviderMatch, existingProvider, specifiedProvider) =
116+
DDLUtils.isHiveTable(existingTable) match {
116117
case false =>
117-
(DataSource.lookupDataSource(existingTable.provider.get),
118-
DataSource.lookupDataSource(tableDesc.provider.get))
118+
val existing = DataSource.lookupDataSource(existingTable.provider.get)
119+
val specified = DataSource.lookupDataSource(tableDesc.provider.get)
120+
(existing == specified, existing.getSimpleName, specified.getSimpleName)
119121
case true =>
120-
(existingTable.provider.get, tableDesc.provider.get)
122+
val existing = existingTable.provider.get
123+
val specified = tableDesc.provider.get
124+
(existing == specified, existing, specified)
121125
}
122126
// Check if the specified data source match the data source of the existing table.
123127
// TODO: Check that options from the resolved relation match the relation that we are
124128
// inserting into (i.e. using the same compression).
125-
if (existingProvider != specifiedProvider) {
129+
if (!isProviderMatch) {
126130
throw new AnalysisException(s"The format of the existing table $tableName is " +
127131
s"`$existingProvider`. It doesn't match the specified format `$specifiedProvider`.")
128132
}

0 commit comments

Comments
 (0)