File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution/command Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -453,12 +453,16 @@ case class AlterTableRecoverPartitionsCommand(
453453 throw new AnalysisException (
454454 s " Operation not allowed: ALTER TABLE RECOVER PARTITIONS on temporary tables: $tableName" )
455455 }
456+ if (DDLUtils .isDatasourceTable(table)) {
457+ throw new AnalysisException (
458+ s " Operation not allowed: ALTER TABLE RECOVER PARTITIONS on datasource tables: $tableName" )
459+ }
456460 if (table.tableType != CatalogTableType .EXTERNAL ) {
457461 throw new AnalysisException (
458462 s " Operation not allowed: ALTER TABLE RECOVER PARTITIONS only works on external " +
459463 s " tables: $tableName" )
460464 }
461- if (table.partitionColumnNames.isEmpty ) {
465+ if (DDLUtils .isTablePartitioned(table) ) {
462466 throw new AnalysisException (
463467 s " Operation not allowed: ALTER TABLE RECOVER PARTITIONS only works on partitioned " +
464468 s " tables: $tableName" )
Original file line number Diff line number Diff line change @@ -409,11 +409,15 @@ case class RepairTableCommand(tableName: TableIdentifier) extends RunnableComman
409409 throw new AnalysisException (
410410 s " Operation not allowed: MSCK REPAIR TABLE on temporary tables: $tableName" )
411411 }
412+ if (DDLUtils .isDatasourceTable(table)) {
413+ throw new AnalysisException (
414+ s " Operation not allowed: MSCK REPAIR TABLE on datasource tables: $tableName" )
415+ }
412416 if (table.tableType != CatalogTableType .EXTERNAL ) {
413417 throw new AnalysisException (
414418 s " Operation not allowed: MSCK REPAIR TABLE only works on external tables: $tableName" )
415419 }
416- if (table.partitionColumnNames.isEmpty ) {
420+ if (DDLUtils .isTablePartitioned(table) ) {
417421 throw new AnalysisException (
418422 s " Operation not allowed: MSCK REPAIR TABLE only works on partitioned tables: $tableName" )
419423 }
You can’t perform that action at this time.
0 commit comments