public class SnapshotUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.Long> |
ancestorIds(Snapshot snapshot,
java.util.function.Function<java.lang.Long,Snapshot> lookup) |
static java.lang.Iterable<java.lang.Long> |
ancestorIdsBetween(long latestSnapshotId,
java.lang.Long oldestSnapshotId,
java.util.function.Function<java.lang.Long,Snapshot> lookup) |
static java.lang.Iterable<Snapshot> |
ancestorsBetween(long latestSnapshotId,
java.lang.Long oldestSnapshotId,
java.util.function.Function<java.lang.Long,Snapshot> lookup) |
static java.lang.Iterable<Snapshot> |
ancestorsOf(long snapshotId,
java.util.function.Function<java.lang.Long,Snapshot> lookup) |
static java.util.List<java.lang.Long> |
currentAncestorIds(Table table)
Return the snapshot IDs for the ancestors of the current table state.
|
static java.lang.Iterable<Snapshot> |
currentAncestors(Table table)
Returns an iterable that traverses the table's snapshots from the current to the last known ancestor.
|
static boolean |
isAncestorOf(Table table,
long ancestorSnapshotId)
Returns whether ancestorSnapshotId is an ancestor of the table's current state.
|
static boolean |
isAncestorOf(Table table,
long snapshotId,
long ancestorSnapshotId)
Returns whether ancestorSnapshotId is an ancestor of snapshotId.
|
static java.util.List<DataFile> |
newFiles(java.lang.Long baseSnapshotId,
long latestSnapshotId,
java.util.function.Function<java.lang.Long,Snapshot> lookup) |
static Snapshot |
oldestAncestor(Table table)
Traverses the history of the table's current snapshot and finds the oldest Snapshot.
|
static Snapshot |
oldestAncestorAfter(Table table,
long timestampMillis)
Traverses the history of the table's current snapshot and finds the first snapshot committed after the given time.
|
static Schema |
schemaFor(Table table,
long snapshotId)
Returns the schema of the table for the specified snapshot.
|
static Schema |
schemaFor(Table table,
java.lang.Long snapshotId,
java.lang.Long timestampMillis)
Convenience method for returning the schema of the table for a snapshot,
when we have a snapshot id or a timestamp.
|
static Snapshot |
snapshotAfter(Table table,
long snapshotId)
Traverses the history of the table's current snapshot and finds the snapshot with the given snapshot id as its
parent.
|
static long |
snapshotIdAsOfTime(Table table,
long timestampMillis)
Returns the ID of the most recent snapshot for the table as of the timestamp.
|
static java.util.List<java.lang.Long> |
snapshotIdsBetween(Table table,
long fromSnapshotId,
long toSnapshotId)
Returns list of snapshot ids in the range - (fromSnapshotId, toSnapshotId]
|
public static boolean isAncestorOf(Table table, long snapshotId, long ancestorSnapshotId)
public static boolean isAncestorOf(Table table, long ancestorSnapshotId)
public static java.lang.Iterable<Snapshot> currentAncestors(Table table)
table
- a Tablepublic static java.util.List<java.lang.Long> currentAncestorIds(Table table)
Ancestor IDs are ordered by commit time, descending. The first ID is the current snapshot, followed by its parent, and so on.
table
- a Table
public static Snapshot oldestAncestor(Table table)
public static java.lang.Iterable<Snapshot> ancestorsOf(long snapshotId, java.util.function.Function<java.lang.Long,Snapshot> lookup)
public static Snapshot oldestAncestorAfter(Table table, long timestampMillis)
table
- a tabletimestampMillis
- a timestamp in millisecondsjava.lang.IllegalStateException
- if the first ancestor after the given time can't be determinedpublic static java.util.List<java.lang.Long> snapshotIdsBetween(Table table, long fromSnapshotId, long toSnapshotId)
This method assumes that fromSnapshotId is an ancestor of toSnapshotId.
public static java.lang.Iterable<java.lang.Long> ancestorIdsBetween(long latestSnapshotId, java.lang.Long oldestSnapshotId, java.util.function.Function<java.lang.Long,Snapshot> lookup)
public static java.lang.Iterable<Snapshot> ancestorsBetween(long latestSnapshotId, java.lang.Long oldestSnapshotId, java.util.function.Function<java.lang.Long,Snapshot> lookup)
public static java.util.List<java.lang.Long> ancestorIds(Snapshot snapshot, java.util.function.Function<java.lang.Long,Snapshot> lookup)
public static java.util.List<DataFile> newFiles(java.lang.Long baseSnapshotId, long latestSnapshotId, java.util.function.Function<java.lang.Long,Snapshot> lookup)
public static Snapshot snapshotAfter(Table table, long snapshotId)
java.lang.IllegalArgumentException
- when the given snapshotId is not found in the tablejava.lang.IllegalStateException
- when the given snapshotId is not an ancestor of the current table statepublic static long snapshotIdAsOfTime(Table table, long timestampMillis)
table
- a Table
timestampMillis
- the timestamp in millis since the Unix epochjava.lang.IllegalArgumentException
- when no snapshot is found in the table
older than the timestamppublic static Schema schemaFor(Table table, long snapshotId)
table
- a Table
snapshotId
- the ID of the snapshotpublic static Schema schemaFor(Table table, java.lang.Long snapshotId, java.lang.Long timestampMillis)
table
- a Table
snapshotId
- the ID of the snapshottimestampMillis
- the timestamp in millis since the Unix epochjava.lang.IllegalArgumentException
- if both snapshotId and timestampMillis are non-null