Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
askwang committed Nov 6, 2024
1 parent cf275ee commit d9324ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ statement
| ALTER TABLE multipartIdentifier createReplaceTagClause #createOrReplaceTag
| ALTER TABLE multipartIdentifier DELETE TAG (IF EXISTS)? identifier #deleteTag
| ALTER TABLE multipartIdentifier RENAME TAG identifier TO identifier #renameTag
| ALTER TABLE multipartIdentifier ROLLBACK TO kind identifier #rollback
| ALTER TABLE multipartIdentifier ROLLBACK TO timeTravelKind identifier #rollback
;

callArgument
Expand Down Expand Up @@ -105,7 +105,7 @@ timeUnit
| MINUTES
;

kind
timeTravelKind
: SNAPSHOT
| TAG
| TIMESTAMP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import org.apache.spark.sql.types.StringType

case class RollbackCommand(
table: Seq[String],
kind: String,
timeTravelKind: String,
version: String,
override val output: Seq[Attribute] = RollbackCommand.getOutputAttrs)
extends PaimonLeafCommand {

override def simpleString(maxFields: Int): String = {
s"Rollback to $kind '$version' for table: $table"
s"Rollback to $timeTravelKind '$version' for table: $table"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ case class RollbackExec(
catalog: TableCatalog,
ident: Identifier,
output: Seq[Attribute],
kind: String,
timeTravelKind: String,
version: String)
extends PaimonLeafV2CommandExec {

Expand All @@ -43,7 +43,7 @@ case class RollbackExec(

table.asInstanceOf[SparkTable].getTable match {
case paimonTable: FileStoreTable =>
kind.toUpperCase(Locale.ROOT) match {
timeTravelKind.toUpperCase(Locale.ROOT) match {

case "SNAPSHOT" =>
assert(version.chars.allMatch(Character.isDigit))
Expand All @@ -59,7 +59,8 @@ case class RollbackExec(
paimonTable.rollbackTo(snapshot.id);

case _ =>
throw new UnsupportedOperationException(s"Unsupported rollback kind '$kind'.")
throw new UnsupportedOperationException(
s"Unsupported rollback timeTravelKind '$timeTravelKind'.")
}
case t =>
throw new UnsupportedOperationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class PaimonSqlExtensionsAstBuilder(delegate: ParserInterface)
override def visitRollback(ctx: RollbackContext): AnyRef = withOrigin(ctx) {
RollbackCommand(
typedVisit[Seq[String]](ctx.multipartIdentifier),
ctx.kind().getText,
ctx.timeTravelKind().getText,
ctx.identifier().getText)
}

Expand Down

0 comments on commit d9324ac

Please sign in to comment.