Skip to content

Commit 78ce7b4

Browse files
authored
[Kernel] [CatalogManaged] Better class/method docs for TableManager, ResolvedTableBuilder, ResolvedTable (#4822)
## 🥞 Stacked PR Use this [link](https://github.com/delta-io/delta/pull/4822/files) to review incremental changes. - [**stack/kernel_catalog_managed_better_docs**](#4822) [[Files changed](https://github.com/delta-io/delta/pull/4822/files)] --------- <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md 2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP] Your PR title ...'. 3. Be sure to keep the PR description updated to reflect all changes. 4. Please write your PR title to summarize what this PR proposes. 5. If possible, provide a concise example to reproduce the issue for a faster review. 6. If applicable, include the corresponding issue number in the PR title and link it in the body. --> #### Which Delta project/connector is this regarding? <!-- Please add the component selected below to the beginning of the pull request title For example: [Spark] Title of my pull request --> - [ ] Spark - [ ] Standalone - [ ] Flink - [X] Kernel - [ ] Other (fill in here) ## Description Better class/method docs for TableManager, ResolvedTableBuilder, ResolvedTable ## How was this patch tested? Comments only. Existing CI. ## Does this PR introduce _any_ user-facing changes? No.
1 parent a87a338 commit 78ce7b4

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

kernel/kernel-api/src/main/java/io/delta/kernel/ResolvedTable.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,46 @@
2222
import java.util.List;
2323
import java.util.Optional;
2424

25-
/** Represents a Delta table resolved to a specific version. */
25+
/**
26+
* Represents a Delta table resolved to a specific version.
27+
*
28+
* <p>A {@code ResolvedTable} is a snapshot of a Delta table at a specific point in time, identified
29+
* by a version number. It provides access to the table's metadata, schema, and capabilities for
30+
* both reading and writing data. This interface is the result of resolving a table through a {@link
31+
* ResolvedTableBuilder} and serves as the entry point for table operations.
32+
*
33+
* <p>The resolved table represents a consistent view of the table at the resolved version. All
34+
* operations on this table will see the same data and metadata, ensuring consistency across reads
35+
* and writes.
36+
*/
2637
@Experimental
2738
public interface ResolvedTable {
39+
40+
/** @return the file system path to the this table */
2841
String getPath();
2942

43+
/** @return the version number of this table snapshot */
3044
long getVersion();
3145

46+
/** @return the timestamp (in milliseconds since Unix epoch) of when this version was committed */
3247
long getTimestamp();
3348

49+
/**
50+
* @return the partition columns of the table at this version, in the order they are defined in
51+
* the table schema. Returns an empty list if the table is not partitioned
52+
*/
3453
List<Column> getPartitionColumns();
3554

55+
/**
56+
* @param domain the domain name to query
57+
* @return the configuration for the provided {@code domain} if it exists in the table, or empty
58+
* if the {@code domain} is not present in the table.
59+
*/
3660
Optional<String> getDomainMetadata(String domain);
3761

62+
/** @return the schema of the table at this version */
3863
StructType getSchema();
3964

65+
/** @return a scan builder for constructing scans to read data from this table */
4066
ScanBuilder getScanBuilder();
4167
}

kernel/kernel-api/src/main/java/io/delta/kernel/ResolvedTableBuilder.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,50 @@
3737
*/
3838
@Experimental
3939
public interface ResolvedTableBuilder {
40+
/**
41+
* Configures the builder to resolve the table at a specific version.
42+
*
43+
* @param version the version number to resolve to
44+
* @return a new builder instance configured for the specified version
45+
*/
4046
ResolvedTableBuilder atVersion(long version);
4147

4248
// TODO: atTimestamp
4349

50+
/**
51+
* Provides parsed log data to optimize table resolution.
52+
*
53+
* <p>When log data is provided, Kernel can avoid reading from the filesystem for information that
54+
* is already available in the parsed data, improving performance.
55+
*
56+
* @param logData the parsed log data to use for optimization
57+
* @return a new builder instance with the provided log data
58+
*/
4459
/** For now, only log datas of type {@link ParsedLogType#RATIFIED_STAGED_COMMIT}s are supported */
4560
ResolvedTableBuilder withLogData(List<ParsedLogData> logData);
4661

47-
// TODO: P & M must be public interfaces, not internal classes
62+
/**
63+
* Provides protocol and metadata information to optimize table resolution.
64+
*
65+
* <p>When protocol and metadata are provided, Kernel can avoid reading this information from the
66+
* filesystem, improving performance.
67+
*
68+
* @param protocol the protocol information
69+
* @param metadata the metadata information
70+
* @return a new builder instance with the provided protocol and metadata
71+
*/
72+
// TODO: [delta-io/delta#4820] Public Protocol API
73+
// TODO: [delta-io/delta#4821] Public Metadata API
4874
ResolvedTableBuilder withProtocolAndMetadata(Protocol protocol, Metadata metadata);
4975

76+
/**
77+
* Constructs the {@link ResolvedTable} using the provided engine.
78+
*
79+
* <p>This method will read any missing information from the filesystem using the provided engine
80+
* to complete the table resolution process.
81+
*
82+
* @param engine the engine to use for filesystem operations
83+
* @return the resolved table instance
84+
*/
5085
ResolvedTable build(Engine engine);
5186
}

kernel/kernel-api/src/main/java/io/delta/kernel/TableManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public interface TableManager {
2727
// TODO static ResolvedTable forPathAtTimestamp(Engine engine, String path, long timestamp);
2828

2929
// TODO: Take in a Committer for write support.
30+
31+
/**
32+
* Creates a builder for loading a Delta table at the given path.
33+
*
34+
* <p>The returned builder can be configured to load the table at a specific version or with
35+
* additional metadata to optimize the loading process.
36+
*
37+
* @param path the file system path to the Delta table
38+
* @return a {@link ResolvedTableBuilder} that can be used to load a {@link ResolvedTable} at the
39+
* given path
40+
*/
3041
static ResolvedTableBuilder loadTable(String path) {
3142
return new ResolvedTableBuilderImpl(path);
3243
}

0 commit comments

Comments
 (0)