forked from delta-io/delta-sharing
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
ea5547c
commit 4b2adb0
Showing
37 changed files
with
882 additions
and
146 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
55 changes: 0 additions & 55 deletions
55
server/core/src/main/java/io/whitefox/core/ReadTableResult.java
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
server/core/src/main/java/io/whitefox/core/ReadTableResultToBeSigned.java
This file was deleted.
Oops, something went wrong.
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
5 changes: 1 addition & 4 deletions
5
.../main/java/io/whitefox/core/Metadata.java → ...java/io/whitefox/core/delta/Metadata.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
3 changes: 2 additions & 1 deletion
3
.../main/java/io/whitefox/core/Protocol.java → ...java/io/whitefox/core/delta/Protocol.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
25 changes: 25 additions & 0 deletions
25
server/core/src/main/java/io/whitefox/core/delta/Stats.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,25 @@ | ||
package io.whitefox.core.delta; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@Data | ||
@Builder(toBuilder = true) | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
public class Stats { | ||
private final long numRecords; | ||
private final Set<ColumnStat<Double>> minValues = Set.of(); | ||
private final Set<ColumnStat<Double>> maxValues = Set.of(); | ||
private final Set<ColumnStat<Long>> nullCount = Set.of(); | ||
@Data | ||
public static class ColumnStat<T> { | ||
private final List<String> columnPath; | ||
private final T value; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
server/core/src/main/java/io/whitefox/core/delta/signed/DeltaFile.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,59 @@ | ||
package io.whitefox.core.delta.signed; | ||
|
||
import io.whitefox.core.delta.unsigned.DeltaFileToBeSigned; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Optional; | ||
|
||
@Data | ||
@Builder(toBuilder = true) | ||
@AllArgsConstructor | ||
public class DeltaFile implements DeltaFileAction { | ||
|
||
/** | ||
* A unique string for the file in a table. The same file is guaranteed to have the same id across multiple requests. A client may cache the file content and use this id as a key to decide whether to use the cached file content. | ||
*/ | ||
private final String id; | ||
|
||
/** | ||
* A unique string for the deletion vector file in a table. The same deletion vector file is guaranteed to have the same id across multiple requests. A client may cache the file content and use this id as a key to decide whether to use the cached file content. | ||
*/ | ||
private final Optional<String> deletionVectorFileId; | ||
|
||
/** | ||
* The table version of the file, returned when querying a table data with a version or timestamp parameter. | ||
*/ | ||
private final Optional<Long> version; | ||
|
||
/** | ||
* The unix timestamp corresponding to the table version of the file, in milliseconds, returned when querying a table data with a version or timestamp parameter. | ||
*/ | ||
private final Optional<Long> timestamp; | ||
|
||
/** | ||
* The unix timestamp corresponding to the expiration of the url, in milliseconds, returned when the server supports the feature. | ||
*/ | ||
private final Optional<Long> expirationTimestamp; | ||
|
||
/** | ||
* Need to be parsed by a delta library as a delta single action, the path field is replaced by pr-signed url. | ||
*/ | ||
private final ParquetFileAction deltaSingleAction; | ||
|
||
public static DeltaFile signed(DeltaFileToBeSigned tbs, | ||
ParquetFileAction signed, | ||
Optional<Long> newExpirationTimestamp, | ||
String newId) { | ||
return new DeltaFile( | ||
newId, | ||
tbs.getDeletionVectorFileId(), | ||
tbs.getVersion(), | ||
tbs.getTimestamp(), | ||
newExpirationTimestamp, | ||
signed | ||
); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
server/core/src/main/java/io/whitefox/core/delta/signed/DeltaFileAction.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,4 @@ | ||
package io.whitefox.core.delta.signed; | ||
|
||
public interface DeltaFileAction extends FileAction { | ||
} |
4 changes: 4 additions & 0 deletions
4
server/core/src/main/java/io/whitefox/core/delta/signed/FileAction.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,4 @@ | ||
package io.whitefox.core.delta.signed; | ||
|
||
public interface FileAction { | ||
} |
74 changes: 74 additions & 0 deletions
74
server/core/src/main/java/io/whitefox/core/delta/signed/ParquetAddFile.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,74 @@ | ||
package io.whitefox.core.delta.signed; | ||
|
||
import io.whitefox.core.delta.Stats; | ||
import io.whitefox.core.delta.unsigned.ParquetAddFileToBeSigned; | ||
import io.whitefox.core.delta.unsigned.ParquetCDFFileToBeSigned; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.net.URI; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class ParquetAddFile implements ParquetFileAction { | ||
/** | ||
* An https url that a client can use to read the file directly. The same file in different responses may have different urls | ||
*/ | ||
private final String url; | ||
/** | ||
* A unique string for the file in a table. The same file is guaranteed to have the same id across multiple requests. A client may cache the file content and use this id as a key to decide whether to use the cached file content. | ||
*/ | ||
private final String id; | ||
/** | ||
* A map from partition column to value for this file. When the table doesn’t have partition columns, this will be an empty map. | ||
*/ | ||
private final Map<String, String> partitionValues; | ||
/** | ||
* The size of this file in bytes. | ||
*/ | ||
private final long size; | ||
/** | ||
* The timestamp of the file in milliseconds from epoch. | ||
*/ | ||
private final long timestamp; | ||
/** | ||
* The table version of this file | ||
*/ | ||
private final int version; | ||
/** | ||
* Contains statistics (e.g., count, min/max values for columns) about the data in this file. This field may be missing. A file may or may not have stats. A client can decide whether to use stats or drop it. | ||
*/ | ||
private final Optional<Stats> stats; | ||
/** | ||
* The unix timestamp corresponding to the expiration of the url, in milliseconds, returned when the server supports the feature. | ||
*/ | ||
private final Optional<Long> expirationTimestamp; | ||
|
||
@Override | ||
public Optional<Long> getExpTs() { | ||
return expirationTimestamp; | ||
} | ||
|
||
public static ParquetAddFile signed( | ||
ParquetAddFileToBeSigned f, | ||
URI signedUrl, | ||
Optional<Long> expirationTimestamp, | ||
String newId | ||
) { | ||
return new ParquetAddFile( | ||
signedUrl.toASCIIString(), | ||
newId, | ||
f.getPartitionValues(), | ||
f.getSize(), | ||
f.getTimestamp(), | ||
f.getVersion(), | ||
f.getStats(), | ||
expirationTimestamp); | ||
} | ||
} |
Oops, something went wrong.