Uh oh!
There was an error while loading. Please reload this page.
Spark-3.3: Handle statistics file clean up from expireSnapshots action/procedure - #6091
Conversation
ajantha-bhat
commented
Nov 1, 2022
cc: @findepi, @rdblue, @szehon-ho |
b557b25 to
7743b5cCompareUh oh!
There was an error while loading. Please reload this page.
bc5575b to
69c1b96Compare69c1b96 to
7a5be5dCompare7a5be5d to
d3b5fa1Compared3b5fa1 to
a9253d8Compareajantha-bhat
commented
Feb 23, 2023
Now that the core functionality PR (#6090) is merged, I think this PR can be reviewed and merged now. cc: @aokolnychyi, @szehon-ho, @rdblue, @jackye1995 |
| List<Object[]> output = sql("CALL %s.system.expire_snapshots('%s')", catalogName, tableIdent); | ||
| assertEquals("Should not delete any files", ImmutableList.of(row(0L, 0L, 0L, 0L, 0L)), output); | ||
| assertEquals( |
There was a problem hiding this comment.
added one more entry for deletedStatisticsFilesCount for all the existing cases.
jackye1995
commented
Feb 23, 2023
I added the core PR to 1.2 release milestone, not sure if we can get this in in time, but I can add it first so it gets more tractions. |
| * returns location of all the statistics files in a table. | ||
| * @return the location of statistics files | ||
| */ | ||
| public static List<String> statisticsFilesLocations(Table table, Set<Long> snapshotIds) { |
There was a problem hiding this comment.
can we simplify the logic of the original method using stream()? Also for this method, I think we can provide a more generic util method that takes in a filter, instead of just adding a specific method to filter by snapshot ID set
There was a problem hiding this comment.
Updated now.
Originally I wanted to keep the same style as manifestListLocations and others. So, I didn't used modified.
jackye1995
left a comment
There was a problem hiding this comment.
this overall looks good to me, just a nit comment
22611ea to
a7413feCompareUh oh!
There was an error while loading. Please reload this page.
a7413fe to
96081b3CompareUh oh!
There was an error while loading. Please reload this page.
f81301d to
1030155Compare1030155 to
6421f45Compare6421f45 to
c4fba5fCompareajantha-bhat
commented
Mar 9, 2023
finally figured out the testcase failure 😄 . It was not failing locally as I didn't rebase it. After rebase it failed locally and the reason is newly merged #6682 was missing a case for stats files. |
Uh oh!
There was an error while loading. Please reload this page.
| } else if (MANIFEST_LIST.equalsIgnoreCase(type)) { | ||
| manifestListsCount.addAndGet(numFiles); | ||
| } else if (STATISTICS_FILES.equalsIgnoreCase(type)) { |
There was a problem hiding this comment.
newly added #6682 was missing this case. Hence, test was failing after rebasing.
c4fba5f to
78b495aCompareajantha-bhat
commented
Mar 9, 2023
@rdblue, @jackye1995 : PR is ready |
| summary.equalityDeleteFilesCount(), | ||
| summary.manifestsCount(), | ||
| summary.manifestListsCount()); | ||
| return ImmutableResult.builder() |
There was a problem hiding this comment.
I am not familiar with this lib but won't the name conflict if we migrate more results to auto-generated beans as it does not take the outer class name into account?
import org.apache.iceberg.actions.ImmutableResult;
There was a problem hiding this comment.
We call it Result in all actions and use outer class for identification.
There was a problem hiding this comment.
good catch. I will check if it is possible to alter the generated class name or include the outer class name.
If I don't find anything in a few hours, I will just use a new private Inner class in ExpireSnapshotsSparkAction.java.
Later It can be easily replaced (as it is private) with Immutables once we have better ways in a follow-up PR.
I don't want to block this PR (targeted for 1.2.0).
There was a problem hiding this comment.
Used @Value.Enclosing So that builder looks like ImmutableExpireSnapshots.Result.builder() now.
In a follow-up PR, I plan to deprecate all public result classes of actions and use immutables annotation for actions to build result objects from that.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| return toFileInfoDS( | ||
| ReachableFileUtil.statisticsFilesLocations(table, predicate), STATISTICS_FILES); |
There was a problem hiding this comment.
nit: Can we define an extra var with a relatively short name like statisticsFiles or locations so that this would fit on one line?
Uh oh!
There was an error while loading. Please reload this page.
aokolnychyi
commented
Mar 10, 2023
Thanks, @ajantha-bhat! Thanks for reviewing, @findepi@rdblue@jackye1995@nastra! |
ajantha-bhat
commented
Mar 11, 2023
Thanks @aokolnychyi for merging this.
|
This change backports PR #6091 to Spark 3.2.
aokolnychyi
commented
Mar 11, 2023
I merged the Spark 3.2 PR, thanks. We stopped active development on 2.4 and 3.1. We also consider dropping 3.1 soon. In my view, it is OK not to cherrypick this change there. Up to you, though. |
) This change backports PR apache#6091 to Spark 3.2.
This PR handles the spark action/procedure side of the statistics file clean-up for expire_snapshots.
It is a follow-up based on the core functionality of #6090