-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
189 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
core/src/main/java/org/apache/iceberg/io/PartitioningDVWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iceberg.io; | ||
|
||
import java.io.IOException; | ||
import java.util.function.Function; | ||
import org.apache.iceberg.PartitionSpec; | ||
import org.apache.iceberg.StructLike; | ||
import org.apache.iceberg.deletes.BaseDVFileWriter; | ||
import org.apache.iceberg.deletes.DVFileWriter; | ||
import org.apache.iceberg.deletes.PositionDelete; | ||
import org.apache.iceberg.deletes.PositionDeleteIndex; | ||
import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||
|
||
/** | ||
* PartitioningDVWriter is a PartitioningWriter implementation which writes DVs for a given file | ||
* position | ||
*/ | ||
public class PartitioningDVWriter<T> | ||
implements PartitioningWriter<PositionDelete<T>, DeleteWriteResult> { | ||
private final DVFileWriter fileWriter; | ||
private DeleteWriteResult result; | ||
|
||
public PartitioningDVWriter( | ||
OutputFileFactory fileFactory, | ||
Function<CharSequence, PositionDeleteIndex> loadPreviousDeletes) { | ||
this.fileWriter = new BaseDVFileWriter(fileFactory, loadPreviousDeletes::apply); | ||
} | ||
|
||
@Override | ||
public void write(PositionDelete<T> row, PartitionSpec spec, StructLike partition) { | ||
fileWriter.delete(row.path().toString(), row.pos(), spec, partition); | ||
} | ||
|
||
@Override | ||
public DeleteWriteResult result() { | ||
Preconditions.checkState(result != null, "Cannot get result from unclosed writer"); | ||
return result; | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
fileWriter.close(); | ||
this.result = fileWriter.result(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.