Package org.apache.iceberg.spark.actions
Class BaseDeleteReachableFilesSparkAction
- java.lang.Object
-
- org.apache.iceberg.spark.actions.BaseDeleteReachableFilesSparkAction
-
- All Implemented Interfaces:
Action<DeleteReachableFiles,DeleteReachableFiles.Result>,DeleteReachableFiles
public class BaseDeleteReachableFilesSparkAction extends java.lang.Object implements DeleteReachableFiles
An implementation ofDeleteReachableFilesthat uses metadata tables in Spark to determine which files should be deleted.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.iceberg.actions.DeleteReachableFiles
DeleteReachableFiles.Result
-
-
Constructor Summary
Constructors Constructor Description BaseDeleteReachableFilesSparkAction(org.apache.spark.sql.SparkSession spark, java.lang.String metadataLocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>buildManifestFileDF(Table table)protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>buildManifestListDF(Table table)protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>buildOtherMetadataFileDF(Table table)protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>buildValidDataFileDF(Table table)protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>buildValidMetadataFileDF(Table table)DeleteReachableFilesdeleteWith(java.util.function.Consumer<java.lang.String> deleteFunc)Passes an alternative delete implementation that will be used for files.DeleteReachableFiles.Resultexecute()Executes this action.DeleteReachableFilesexecuteDeleteWith(java.util.concurrent.ExecutorService executorService)Passes an alternative executor service that will be used for files removal.DeleteReachableFilesio(FileIO fileIO)Set theFileIOto be used for files removalprotected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>loadMetadataTable(Table table, MetadataTableType type)protected JobGroupInfonewJobGroupInfo(java.lang.String groupId, java.lang.String desc)protected TablenewStaticTable(TableMetadata metadata, FileIO io)ThisToption(java.lang.String name, java.lang.String value)Configures this action with an extra option.protected java.util.Map<java.lang.String,java.lang.String>options()ThisToptions(java.util.Map<java.lang.String,java.lang.String> newOptions)Configures this action with extra options.protected DeleteReachableFilesself()protected org.apache.spark.sql.SparkSessionspark()protected org.apache.spark.api.java.JavaSparkContextsparkContext()protected <T> TwithJobGroupInfo(JobGroupInfo info, java.util.function.Supplier<T> supplier)
-
-
-
Method Detail
-
self
protected DeleteReachableFiles self()
-
io
public DeleteReachableFiles io(FileIO fileIO)
Description copied from interface:DeleteReachableFilesSet theFileIOto be used for files removal- Specified by:
ioin interfaceDeleteReachableFiles- Parameters:
fileIO- FileIO to use for files removal- Returns:
- this for method chaining
-
deleteWith
public DeleteReachableFiles deleteWith(java.util.function.Consumer<java.lang.String> deleteFunc)
Description copied from interface:DeleteReachableFilesPasses an alternative delete implementation that will be used for files.- Specified by:
deleteWithin interfaceDeleteReachableFiles- Parameters:
deleteFunc- a function that will be called to delete files. The function accepts path to file as an argument.- Returns:
- this for method chaining
-
executeDeleteWith
public DeleteReachableFiles executeDeleteWith(java.util.concurrent.ExecutorService executorService)
Description copied from interface:DeleteReachableFilesPasses an alternative executor service that will be used for files removal.If this method is not called, files will be deleted in the current thread.
- Specified by:
executeDeleteWithin interfaceDeleteReachableFiles- Parameters:
executorService- the service to use- Returns:
- this for method chaining
-
execute
public DeleteReachableFiles.Result execute()
Description copied from interface:ActionExecutes this action.- Specified by:
executein interfaceAction<DeleteReachableFiles,DeleteReachableFiles.Result>- Returns:
- the result of this action
-
buildOtherMetadataFileDF
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> buildOtherMetadataFileDF(Table table)
-
spark
protected org.apache.spark.sql.SparkSession spark()
-
sparkContext
protected org.apache.spark.api.java.JavaSparkContext sparkContext()
-
option
public ThisT option(java.lang.String name, java.lang.String value)Description copied from interface:ActionConfigures this action with an extra option.Certain actions allow users to control internal details of their execution via options.
-
options
public ThisT options(java.util.Map<java.lang.String,java.lang.String> newOptions)
Description copied from interface:ActionConfigures this action with extra options.Certain actions allow users to control internal details of their execution via options.
-
options
protected java.util.Map<java.lang.String,java.lang.String> options()
-
withJobGroupInfo
protected <T> T withJobGroupInfo(JobGroupInfo info, java.util.function.Supplier<T> supplier)
-
newJobGroupInfo
protected JobGroupInfo newJobGroupInfo(java.lang.String groupId, java.lang.String desc)
-
newStaticTable
protected Table newStaticTable(TableMetadata metadata, FileIO io)
-
buildValidDataFileDF
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> buildValidDataFileDF(Table table)
-
buildManifestFileDF
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> buildManifestFileDF(Table table)
-
buildManifestListDF
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> buildManifestListDF(Table table)
-
buildValidMetadataFileDF
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> buildValidMetadataFileDF(Table table)
-
loadMetadataTable
protected org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> loadMetadataTable(Table table, MetadataTableType type)
-
-