rdblue commented on a change in pull request #1525:
URL: https://github.com/apache/iceberg/pull/1525#discussion_r535793465
##########
File path: spark3/src/main/java/org/apache/iceberg/actions/SparkActions.java
##########
@@ -20,10 +20,75 @@
package org.apache.iceberg.actions;
import org.apache.iceberg.Table;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.spark.Spark3Util;
import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.catalyst.parser.ParseException;
-class SparkActions extends Actions {
+public class SparkActions extends Actions {
protected SparkActions(SparkSession spark, Table table) {
super(spark, table);
}
+
+ public static CreateAction migrate(String tableName) {
+ return migrate(SparkSession.active(), tableName);
+ }
+
+ public static CreateAction migrate(SparkSession spark, String tableName) {
+ Spark3Util.CatalogAndIdentifier catalogAndIdentifier;
+ try {
+ catalogAndIdentifier = Spark3Util.catalogAndIdentifier(spark, tableName);
+ } catch (ParseException e) {
+ throw new IllegalArgumentException("Cannot parse migrate target", e);
+ }
+
+ return new Spark3MigrateAction(spark, catalogAndIdentifier.catalog(),
catalogAndIdentifier.identifier());
+ }
+
+ public static CreateAction snapshot(String sourceId, String destId) {
+ return snapshot(SparkSession.active(), sourceId, destId);
+ }
+
+ public static CreateAction snapshot(SparkSession spark, String sourceId,
String destId) {
+ Spark3Util.CatalogAndIdentifier sourceIdent;
+ try {
+ sourceIdent = Spark3Util.catalogAndIdentifier(spark, sourceId);
+ } catch (ParseException e) {
+ throw new IllegalArgumentException("Cannot parse snapshot source", e);
+ }
Review comment:
Can you add more whitespace between control flow blocks in this PR?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]