-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add support for deletion vector in Iceberg #24882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,9 @@ | |
| */ | ||
| package io.trino.plugin.iceberg; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import io.trino.plugin.hive.FileWriter; | ||
| import org.apache.iceberg.FileFormat; | ||
| import org.apache.iceberg.Metrics; | ||
|
|
||
| import java.util.List; | ||
|
|
@@ -22,6 +24,15 @@ | |
| public interface IcebergFileWriter | ||
| extends FileWriter | ||
| { | ||
| FileFormat fileFormat(); | ||
|
|
||
| String location(); | ||
|
|
||
| default List<String> rewrittenDeleteFiles() | ||
| { | ||
| return ImmutableList.of(); | ||
| } | ||
|
Comment on lines
31
to
34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method feels somehow artificial for the generic
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it used in IcebergMetadat#finishWrite for I don't have right now a solution to suggest, but I feel we can do better also with Did we explore the avenue of having |
||
|
|
||
| FileMetrics getFileMetrics(); | ||
|
|
||
| record FileMetrics(Metrics metrics, Optional<List<Long>> splitOffsets) {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |
| import org.apache.iceberg.Schema; | ||
| import org.apache.iceberg.io.LocationProvider; | ||
| import org.apache.iceberg.types.Type; | ||
| import org.apache.iceberg.util.DeleteFileSet; | ||
| import org.roaringbitmap.longlong.ImmutableLongBitmapDataProvider; | ||
| import org.roaringbitmap.longlong.LongBitmapDataProvider; | ||
| import org.roaringbitmap.longlong.Roaring64Bitmap; | ||
|
|
@@ -55,8 +56,10 @@ public class IcebergMergeSink | |
| private final LocationProvider locationProvider; | ||
| private final IcebergFileWriterFactory fileWriterFactory; | ||
| private final TrinoFileSystem fileSystem; | ||
| private final Map<String, DeleteFileSet> previousDeleteFiles; | ||
| private final JsonCodec<CommitTaskData> jsonCodec; | ||
| private final ConnectorSession session; | ||
| private final int formatVersion; | ||
| private final IcebergFileFormat fileFormat; | ||
| private final Map<String, String> storageProperties; | ||
| private final Schema schema; | ||
|
|
@@ -69,8 +72,10 @@ public IcebergMergeSink( | |
| LocationProvider locationProvider, | ||
| IcebergFileWriterFactory fileWriterFactory, | ||
| TrinoFileSystem fileSystem, | ||
| Map<String, DeleteFileSet> previousDeleteFiles, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of passing in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my initial implementation, but I moved to this class because we have to build the map several times if we put in |
||
| JsonCodec<CommitTaskData> jsonCodec, | ||
| ConnectorSession session, | ||
| int formatVersion, | ||
| IcebergFileFormat fileFormat, | ||
| Map<String, String> storageProperties, | ||
| Schema schema, | ||
|
|
@@ -81,8 +86,10 @@ public IcebergMergeSink( | |
| this.locationProvider = requireNonNull(locationProvider, "locationProvider is null"); | ||
| this.fileWriterFactory = requireNonNull(fileWriterFactory, "fileWriterFactory is null"); | ||
| this.fileSystem = requireNonNull(fileSystem, "fileSystem is null"); | ||
| this.previousDeleteFiles = ImmutableMap.copyOf(previousDeleteFiles); | ||
| this.jsonCodec = requireNonNull(jsonCodec, "jsonCodec is null"); | ||
| this.session = requireNonNull(session, "session is null"); | ||
| this.formatVersion = formatVersion; | ||
| this.fileFormat = requireNonNull(fileFormat, "fileFormat is null"); | ||
| this.storageProperties = ImmutableMap.copyOf(requireNonNull(storageProperties, "storageProperties is null")); | ||
| this.schema = requireNonNull(schema, "schema is null"); | ||
|
|
@@ -162,8 +169,10 @@ private PositionDeleteWriter createPositionDeleteWriter(String dataFilePath, Par | |
| fileSystem, | ||
| jsonCodec, | ||
| session, | ||
| formatVersion, | ||
| fileFormat, | ||
| storageProperties); | ||
| storageProperties, | ||
| previousDeleteFiles); | ||
| } | ||
|
|
||
| private static Collection<Slice> writePositionDeletes(PositionDeleteWriter writer, ImmutableLongBitmapDataProvider rowsToDelete) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.