Skip to content

Commit 32857e6

Browse files
committed
address comments
1 parent d5a464d commit 32857e6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/command/createDataSourceTables.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ case class CreateDataSourceTableAsSelectCommand(
160160

161161
if (existingTable.provider.get == DDLUtils.HIVE_PROVIDER) {
162162
throw new AnalysisException(s"Saving data in the Hive serde table $tableName is " +
163-
s"not supported yet. Please use the insertInto() API as an alternative.")
163+
"not supported yet. Please use the insertInto() API as an alternative.")
164164
}
165165

166166
// Check if the specified data source match the data source of the existing table.
@@ -192,13 +192,18 @@ case class CreateDataSourceTableAsSelectCommand(
192192
}
193193
})
194194

195+
// In `AnalyzeCreateTable`, we verified the consistency between the user-specified table
196+
// definition(partition columns, bucketing) and the SELECT query, here we also need to
197+
// verify the the consistency between the user-specified table definition and the existing
198+
// table definition.
199+
195200
// Check if the specified partition columns match the existing table.
196201
val specifiedPartCols = CatalogUtils.normalizePartCols(
197202
tableName, tableCols, table.partitionColumnNames, resolver)
198203
if (specifiedPartCols != existingTable.partitionColumnNames) {
199204
throw new AnalysisException(
200205
s"""
201-
|Specified partitioning does not match the existing table $tableName.
206+
|Specified partitioning does not match that of the existing table $tableName.
202207
|Specified partition columns: [${specifiedPartCols.mkString(", ")}]
203208
|Existing partition columns: [${existingTable.partitionColumnNames.mkString(", ")}]
204209
""".stripMargin)
@@ -215,7 +220,7 @@ case class CreateDataSourceTableAsSelectCommand(
215220
existingTable.bucketSpec.map(_.toString).getOrElse("not bucketed")
216221
throw new AnalysisException(
217222
s"""
218-
|Specified bucketing does not match the existing table $tableName.
223+
|Specified bucketing does not match that of the existing table $tableName.
219224
|Specified bucketing: $specifiedBucketString
220225
|Existing bucketing: $existingBucketString
221226
""".stripMargin)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSQLContext with Be
611611
val e = intercept[AnalysisException] {
612612
Seq(3 -> "c").toDF("i", "j").write.bucketBy(3, "i").mode("append").saveAsTable("t")
613613
}
614-
assert(e.message.contains("Specified bucketing does not match the existing table"))
614+
assert(e.message.contains("Specified bucketing does not match that of the existing table"))
615615
}
616616
}
617617

0 commit comments

Comments
 (0)