You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/08/08 21:29:09 UTC

[GitHub] [iceberg] aokolnychyi opened a new pull request, #5469: Spark 3.3: Use typed beans in BaseSparkAction

aokolnychyi opened a new pull request, #5469:
URL: https://github.com/apache/iceberg/pull/5469

   This PR switches `BaseSparkAction` to use typed beans instead of generic `Row`. This allows us to avoid unreliable index-based access and enables having more typed operations.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] kbendick commented on pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
kbendick commented on PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#issuecomment-1209917378

   > @karuppayya is working on benchmarks for actions. We will make sure to test everything before it is released.
   
   Cool. I don't have any issues on the technical merits of the PR and the typed values would be _much_ nicer to work with if there's no major performance overhead. Thanks @aokolnychyi!


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#issuecomment-1210045376

   > I like the using of type beans (I guess my fault for not using that originally :)
   
   @szehon-ho, I think we just historically used `Row` in all these methods. There are more and more use cases where we can benefit from more specific types so it seems beneficial to switch now.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941891416


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.

Review Comment:
   Lookng more, I think this is correct but this class is really confusing now (too many side-effects, and possible order of calling execute() vs expiredFiles()). 
   
   Need to understand more what use case you envision but, would this be better?
   ```
   Dataset<FileInfo> execute(boolean delete)
   ```



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941824314


##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/actions/TestExpireSnapshotsAction.java:
##########
@@ -1176,10 +1176,10 @@ public void testExpireAction() {
 
     Assert.assertEquals("Should not delete any files", 0, deletedFiles.size());
 
-    Assert.assertSame(
-        "Multiple calls to expire should return the same deleted files",
-        pendingDeletes,
-        action.expire());
+    Assert.assertEquals(

Review Comment:
   This no longer has to be the same reference. I reuse `QueryExecution` so we keep the old behavior. I added a new test below. It would fail otherwise.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941891416


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.

Review Comment:
   Lookng more, I think this is correct but a bit confusing for a user to use.  (like, should they call it before or after).  Would it make more sense to have a method expiredFiles() that returns the saved dataset from execute(), and just not have it work before execute()?



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941924589


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.

Review Comment:
   Well, I had the same question when I started looking. I thought you either call `execute` or `expire`. Then I saw the following comment in Javadoc and related tests.
   
   ```
   This may be called before or after {@link #execute()} to return the expired files.
   ```
   
   It turns out one could call `expire` after `execute` to fetch the list of expired files and it magically worked cause Spark was reusing shuffle data. I had to keep the old behavior. I just changed the type of the instance variable that used to cache the data frame.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941821772


##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/actions/TestExpireSnapshotsAction.java:
##########
@@ -1215,4 +1215,39 @@ public void testUseLocalIterator() {
               jobsRunDuringStreamResults);
         });
   }
+
+  @Test
+  public void testExpireAfterExecute() {
+    table
+        .newAppend()
+        .appendFile(FILE_A) // data_bucket=0
+        .commit();
+
+    rightAfterSnapshot();
+
+    table
+        .newAppend()
+        .appendFile(FILE_B) // data_bucket=1
+        .commit();
+
+    table
+        .newAppend()
+        .appendFile(FILE_C) // data_bucket=2
+        .commit();
+
+    long t3 = rightAfterSnapshot();
+
+    ExpireSnapshotsSparkAction action = SparkActions.get().expireSnapshots(table);
+
+    action.expireOlderThan(t3).retainLast(2);
+
+    ExpireSnapshots.Result result = action.execute();
+    checkExpirationResults(0L, 0L, 0L, 0L, 1L, result);
+
+    List<FileInfo> typedExpiredFiles = action.expireFiles().collectAsList();

Review Comment:
   Yeah, I kept those tests for now to make sure the old method works as expected.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941923295


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
+   *
+   * @return a Dataset of files that are no longer referenced by the table
+   */
+  public Dataset<FileInfo> expireFiles() {
+    return expiredFileDS();

Review Comment:
   Oops, not needed anymore. Removed.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r942699682


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.

Review Comment:
   Ah sorry about it, didn't see it's a move and unrelated to the change.  
   
   Yea this class is not great, but not this pr's problem.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#issuecomment-1209896487

   cc @kbendick @rdblue @flyrain @szehon-ho @RussellSpitzer @karuppayya @anuragmantri 


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] kbendick commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
kbendick commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941819922


##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/actions/TestExpireSnapshotsAction.java:
##########
@@ -1215,4 +1215,39 @@ public void testUseLocalIterator() {
               jobsRunDuringStreamResults);
         });
   }
+
+  @Test
+  public void testExpireAfterExecute() {
+    table
+        .newAppend()
+        .appendFile(FILE_A) // data_bucket=0
+        .commit();
+
+    rightAfterSnapshot();
+
+    table
+        .newAppend()
+        .appendFile(FILE_B) // data_bucket=1
+        .commit();
+
+    table
+        .newAppend()
+        .appendFile(FILE_C) // data_bucket=2
+        .commit();
+
+    long t3 = rightAfterSnapshot();
+
+    ExpireSnapshotsSparkAction action = SparkActions.get().expireSnapshots(table);
+
+    action.expireOlderThan(t3).retainLast(2);
+
+    ExpireSnapshots.Result result = action.execute();
+    checkExpirationResults(0L, 0L, 0L, 0L, 1L, result);
+
+    List<FileInfo> typedExpiredFiles = action.expireFiles().collectAsList();

Review Comment:
   We might want to update more of these tests off of `expire` and onto `expireFiles` (and off of `Dataset<Row>` in the process).
   
   But having this one test is sufficient and we can cleanup the tests more during deprecation or in a later 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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#issuecomment-1209916257

   @karuppayya is working on benchmarks for actions. We will make sure to test everything before it is released.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi commented on pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#issuecomment-1211027899

   Thanks, @kbendick @szehon-ho!


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aokolnychyi merged pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
aokolnychyi merged PR #5469:
URL: https://github.com/apache/iceberg/pull/5469


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5469: Spark 3.3: Use typed beans in BaseSparkAction

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #5469:
URL: https://github.com/apache/iceberg/pull/5469#discussion_r941890293


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
+   *
+   * @return a Dataset of files that are no longer referenced by the table
+   */
+  public Dataset<FileInfo> expireFiles() {
+    return expiredFileDS();

Review Comment:
   Not sure I see the point of a separate method here?



##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -140,19 +142,39 @@ public ExpireSnapshotsSparkAction deleteWith(Consumer<String> newDeleteFunc) {
    *
    * <p>This does not delete data files. To delete data files, run {@link #execute()}.
    *
-   * <p>This may be called before or after {@link #execute()} is called to return the expired file
-   * list.
+   * <p>This may be called before or after {@link #execute()} to return the expired files.
    *
    * @return a Dataset of files that are no longer referenced by the table
+   * @deprecated since 1.0.0, will be removed in 1.1.0; use {@link #expireFiles()} instead.
    */
+  @Deprecated
   public Dataset<Row> expire() {
-    if (expiredFiles == null) {
+    // rely on the same query execution to reuse shuffles
+    QueryExecution queryExecution = expiredFileDS().queryExecution();
+    return new Dataset<>(queryExecution, RowEncoder.apply(queryExecution.analyzed().schema()));
+  }
+
+  /**
+   * Expires snapshots and commits the changes to the table, returning a Dataset of files to delete.
+   *
+   * <p>This does not delete data files. To delete data files, run {@link #execute()}.
+   *
+   * <p>This may be called before or after {@link #execute()} to return the expired files.

Review Comment:
   We can't call this method before execute(), can we?  As execute currently calls this method.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org