1
0

[HUDI-3515] Making rdd unpersist optional at the end of writes (#4898)

Co-authored-by: 苏承祥 <sucx@tuya.com>
This commit is contained in:
苏承祥
2022-02-26 00:30:10 +08:00
committed by GitHub
parent b50f4b491c
commit 92cdc5987a
3 changed files with 68 additions and 5 deletions

View File

@@ -531,7 +531,11 @@ public class SparkRDDWriteClient<T extends HoodieRecordPayload> extends
@Override
protected void releaseResources() {
((HoodieSparkEngineContext) context).getJavaSparkContext().getPersistentRDDs().values()
.forEach(rdd -> rdd.unpersist());
// If we do not explicitly release the resource, spark will automatically manage the resource and clean it up automatically
// see: https://spark.apache.org/docs/latest/rdd-programming-guide.html#removing-data
if (config.areReleaseResourceEnabled()) {
((HoodieSparkEngineContext) context).getJavaSparkContext().getPersistentRDDs().values()
.forEach(JavaRDD::unpersist);
}
}
}