RussellSpitzer commented on a change in pull request #3685: URL: https://github.com/apache/iceberg/pull/3685#discussion_r768016870
########## File path: spark/v2.4/spark/src/main/java/org/apache/iceberg/actions/Actions.java ########## @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iceberg.actions; + +import org.apache.iceberg.Table; +import org.apache.iceberg.common.DynConstructors; +import org.apache.spark.sql.SparkSession; + +/** + * An API for interacting with actions in Spark. + * + * @deprecated since 0.12.0, Used for supporting {@link RewriteDataFilesAction} in spark-2.4 for backward compatibility. + * Also this implementation is no longer maintained. + * Preferred to use new implementation {@link BaseRewriteDataFilesSpark3Action} available with Spark 3.x. + */ +@Deprecated +public class Actions { + + /* + We load the actual implementation of Actions via reflection to allow for differences + between the major Spark APIs while still defining the API in this class. + */ + private static final String IMPL_NAME = "SparkActions"; + private static DynConstructors.Ctor<Actions> implConstructor; + + private static String implClass() { + return Actions.class.getPackage().getName() + "." + IMPL_NAME; + } + + private static DynConstructors.Ctor<Actions> actionConstructor() { + if (implConstructor == null) { + String className = implClass(); + try { + implConstructor = + DynConstructors.builder().hiddenImpl(className, SparkSession.class, Table.class).buildChecked(); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("Cannot find appropriate Actions implementation on the classpath.", e); + } + } + return implConstructor; + } + + private SparkSession spark; + private Table table; + + protected Actions(SparkSession spark, Table table) { + this.spark = spark; + this.table = table; + } + + /** + * @deprecated since 0.12.0, Used for supporting {@link RewriteDataFilesAction} + * in spark-2.4 for backward compatibility. + * Also this implementation is no longer maintained. Review comment: I would changed this to "This implementation is no longer maintained, the new implementation {link} is available with Spark 3.x" The structure here is a bit complicated. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
