1717
1818import static java .util .Objects .requireNonNull ;
1919
20- import io .delta .kernel .CommitRange ;
21- import io .delta .kernel .Snapshot ;
22- import io .delta .kernel .engine .Engine ;
23- import io .delta .kernel .internal .files .ParsedLogData ;
2420import io .delta .kernel .spark .snapshot .ManagedCatalogAdapter ;
25- import java . util . List ;
21+ import io . delta . storage . commit . GetCommitsResponse ;
2622import java .util .Optional ;
2723import org .apache .spark .sql .SparkSession ;
2824import org .apache .spark .sql .catalyst .catalog .CatalogTable ;
2925
3026/**
31- * UC-backed implementation shell of {@link ManagedCatalogAdapter}.
27+ * Unity Catalog implementation of {@link ManagedCatalogAdapter}.
3228 *
33- * <p>Methods are intentionally stubbed in this wireframe PR and will be implemented in a follow-up
34- * once UC operations are enabled.
29+ * <p>This adapter is responsible only for fetching commit metadata from Unity Catalog's commit
30+ * coordinator API. It does not contain any Delta/Kernel snapshot building logic - that
31+ * responsibility belongs to the snapshot manager layer.
32+ *
33+ * <p>Methods are stubbed in this wireframe PR and will be implemented in a follow-up once UC
34+ * operations are enabled.
3535 */
3636public final class UnityCatalogAdapter implements ManagedCatalogAdapter {
3737
@@ -48,16 +48,21 @@ public UnityCatalogAdapter(String tableId, String tablePath, String endpoint, St
4848 }
4949
5050 /**
51- * Creates adapter from Spark catalog table (convenience method).
51+ * Creates adapter from Spark catalog table.
52+ *
53+ * <p>Extracts UC connection info from Spark metadata and creates the adapter.
5254 *
53- * <p>Extracts UC connection info from Spark metadata and delegates to {@link
54- * #fromConnectionInfo}.
55+ * @param catalogTable the catalog table metadata
56+ * @param spark the active SparkSession
57+ * @return Optional containing the adapter if this is a UC-managed table, empty otherwise
5558 */
5659 public static Optional <ManagedCatalogAdapter > fromCatalog (
5760 CatalogTable catalogTable , SparkSession spark ) {
5861 requireNonNull (catalogTable , "catalogTable is null" );
5962 requireNonNull (spark , "spark is null" );
60- throw new UnsupportedOperationException ("UC wiring deferred to implementation PR" );
63+
64+ return SparkUnityCatalogUtils .extractConnectionInfo (catalogTable , spark )
65+ .map (UnityCatalogAdapter ::fromConnectionInfo );
6166 }
6267
6368 /** Creates adapter from connection info (no Spark dependency). */
@@ -67,50 +72,39 @@ public static ManagedCatalogAdapter fromConnectionInfo(UnityCatalogConnectionInf
6772 info .getTableId (), info .getTablePath (), info .getEndpoint (), info .getToken ());
6873 }
6974
75+ @ Override
7076 public String getTableId () {
7177 return tableId ;
7278 }
7379
80+ @ Override
7481 public String getTablePath () {
7582 return tablePath ;
7683 }
7784
85+ /** Returns the UC endpoint URL. */
7886 public String getEndpoint () {
7987 return endpoint ;
8088 }
8189
90+ /** Returns the UC authentication token. */
8291 public String getToken () {
8392 return token ;
8493 }
8594
8695 @ Override
87- public Snapshot loadSnapshot (
88- Engine engine , Optional <Long > versionOpt , Optional <Long > timestampOpt ) {
89- throw new UnsupportedOperationException ("UC snapshot loading not implemented yet" );
90- }
91-
92- @ Override
93- public CommitRange loadCommitRange (
94- Engine engine ,
95- Optional <Long > startVersionOpt ,
96- Optional <Long > startTimestampOpt ,
97- Optional <Long > endVersionOpt ,
98- Optional <Long > endTimestampOpt ) {
99- throw new UnsupportedOperationException ("UC commit range loading not implemented yet" );
100- }
101-
102- @ Override
103- public List <ParsedLogData > getRatifiedCommits (Optional <Long > endVersionOpt ) {
104- throw new UnsupportedOperationException ("UC commit listing not implemented yet" );
96+ public GetCommitsResponse getCommits (long startVersion , Optional <Long > endVersion ) {
97+ requireNonNull (endVersion , "endVersion is null" );
98+ throw new UnsupportedOperationException ("UC getCommits not implemented yet" );
10599 }
106100
107101 @ Override
108102 public long getLatestRatifiedVersion () {
109- throw new UnsupportedOperationException ("UC ratified version lookup not implemented yet" );
103+ throw new UnsupportedOperationException ("UC getLatestRatifiedVersion not implemented yet" );
110104 }
111105
112106 @ Override
113107 public void close () {
114- // no-op in wireframe
108+ // no-op in wireframe; will close UCClient in implementation
115109 }
116110}
0 commit comments