RussellSpitzer commented on code in PR #6581: URL: https://github.com/apache/iceberg/pull/6581#discussion_r1072839234
########## spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java: ########## @@ -361,4 +368,25 @@ static FileInfo toFileInfo(ContentFile<?> file) { return new FileInfo(file.path().toString(), file.content().toString()); } } + + protected <T, U> U withReusableDS(Dataset<T> ds, Function<Dataset<T>, U> func) { + Dataset<T> reusableDS; + boolean useCaching = + PropertyUtil.propertyAsBoolean(options(), USE_CACHING, USE_CACHING_DEFAULT); + if (useCaching) { + reusableDS = ds.cache(); + } else { + int parallelism = SQLConf.get().numShufflePartitions(); + reusableDS = + ds.repartition(parallelism).map((MapFunction<T, T>) value -> value, ds.exprEnc()); Review Comment: why do we repartition here? (and encode) -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org