Skip to content

Commit

Permalink
Address Dongjoon's review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGekk committed Feb 16, 2021
1 parent 79ec7a1 commit 7b9ee52
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions docs/sql-ref-syntax-ddl-repair-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license: |
### Syntax

```sql
MSCK REPAIR TABLE table_identifier [[ADD|DROP|SYNC] PARTITIONS]
MSCK REPAIR TABLE table_identifier [{ADD|DROP|SYNC} PARTITIONS]
```

### Parameters
Expand All @@ -37,11 +37,11 @@ MSCK REPAIR TABLE table_identifier [[ADD|DROP|SYNC] PARTITIONS]

**Syntax:** `[ database_name. ] table_name`

* **`[[ADD|DROP|SYNC] PARTITIONS]`**
* **`{ADD|DROP|SYNC} PARTITIONS`**

* If the option is not specified, `MSCK REPAIR TABLE` adds partitions to the Hive external catalog only.
* **ADD**, the command adds new partitions in the catalog for all sub-folder in the base table folder that don't belong to any table partitions.
* **DROP**, the command drops all partitions from the Hive external catalog that have non-existing locations in the file system.
* If specified, `MSCK REPAIR TABLE` only adds partitions to the session catalog.
* **ADD**, the command adds new partitions to the session catalog for all sub-folder in the base table folder that don't belong to any table partitions.
* **DROP**, the command drops all partitions from the session catalog that have non-existing locations in the file system.
* **SYNC** is the combination of **DROP** and **ADD**.

### Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ statement
multipartIdentifier partitionSpec? #loadData
| TRUNCATE TABLE multipartIdentifier partitionSpec? #truncateTable
| MSCK REPAIR TABLE multipartIdentifier
(option=(ADD|DROP|SYNC) PARTITIONS)? #repairTable
(option=(ADD|DROP|SYNC) PARTITIONS)? #repairTable
| op=(ADD | LIST) identifier (STRING | .*?) #manageResource
| SET ROLE .*? #failNativeCommand
| SET TIME ZONE interval #setTimeZone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3659,7 +3659,7 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
*
* For example:
* {{{
* MSCK REPAIR TABLE multi_part_name [[ADD|DROP|SYNC] PARTITIONS]
* MSCK REPAIR TABLE multi_part_name [{ADD|DROP|SYNC} PARTITIONS]
* }}}
*/
override def visitRepairTable(ctx: RepairTableContext): LogicalPlan = withOrigin(ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ case class PartitionStatistics(numFiles: Int, totalSize: Long)
* The syntax of this command is:
* {{{
* ALTER TABLE table RECOVER PARTITIONS;
* MSCK REPAIR TABLE table [[ADD|DROP|SYNC] PARTITIONS];
* MSCK REPAIR TABLE table [{ADD|DROP|SYNC} PARTITIONS];
* }}}
*/
case class AlterTableRecoverPartitionsCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ package org.apache.spark.sql.execution.command
import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedTable}
import org.apache.spark.sql.catalyst.parser.CatalystSqlParser.parsePlan
import org.apache.spark.sql.catalyst.plans.logical.RepairTable
import org.apache.spark.sql.test.SharedSparkSession

class MsckRepairTableParserSuite extends AnalysisTest with SharedSparkSession {
class MsckRepairTableParserSuite extends AnalysisTest {
test("repair a table") {
comparePlans(
parsePlan("MSCK REPAIR TABLE a.b.c"),
Expand Down

0 comments on commit 7b9ee52

Please sign in to comment.