diff --git a/paimon-spark/paimon-spark-common/src/main/antlr4/org.apache.spark.sql.catalyst.parser.extensions/PaimonSqlExtensions.g4 b/paimon-spark/paimon-spark-common/src/main/antlr4/org.apache.spark.sql.catalyst.parser.extensions/PaimonSqlExtensions.g4 index 9abf7d8bf85c..e0a115251e05 100644 --- a/paimon-spark/paimon-spark-common/src/main/antlr4/org.apache.spark.sql.catalyst.parser.extensions/PaimonSqlExtensions.g4 +++ b/paimon-spark/paimon-spark-common/src/main/antlr4/org.apache.spark.sql.catalyst.parser.extensions/PaimonSqlExtensions.g4 @@ -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 @@ -105,7 +105,7 @@ timeUnit | MINUTES ; -kind +timeTravelKind : SNAPSHOT | TAG | TIMESTAMP diff --git a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/plans/logical/RollbackCommand.scala b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/plans/logical/RollbackCommand.scala index 3e610079775f..d4687f24c96a 100644 --- a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/plans/logical/RollbackCommand.scala +++ b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/plans/logical/RollbackCommand.scala @@ -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" } } diff --git a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/execution/RollbackExec.scala b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/execution/RollbackExec.scala index 4e9c23b518e8..4e0d2d139502 100644 --- a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/execution/RollbackExec.scala +++ b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/execution/RollbackExec.scala @@ -33,7 +33,7 @@ case class RollbackExec( catalog: TableCatalog, ident: Identifier, output: Seq[Attribute], - kind: String, + timeTravelKind: String, version: String) extends PaimonLeafV2CommandExec { @@ -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)) @@ -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( diff --git a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/PaimonSqlExtensionsAstBuilder.scala b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/PaimonSqlExtensionsAstBuilder.scala index 2969229b8c87..ed0ce4e6f712 100644 --- a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/PaimonSqlExtensionsAstBuilder.scala +++ b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/PaimonSqlExtensionsAstBuilder.scala @@ -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) }