This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new 4ddc5fd4a210 [SPARK-33902][SQL][FOLLOWUP] Add createTableLike 
delegation to DelegatingCatalogExtension
4ddc5fd4a210 is described below

commit 4ddc5fd4a2108f19bef839d12fc70a1684dedccc
Author: Kousuke Saruta <[email protected]>
AuthorDate: Tue May 19 13:06:17 2026 -0700

    [SPARK-33902][SQL][FOLLOWUP] Add createTableLike delegation to 
DelegatingCatalogExtension
    
    ### What changes were proposed in this pull request?
    This PR adds the missing `createTableLike(Identifier, TableInfo, Table)` 
delegation to `DelegatingCatalogExtension`.
    
    ### Why are the changes needed?
    `DelegatingCatalogExtension` is designed to delegate all catalog operations 
to the underlying session catalog, so that subclasses (e.g., Delta's 
`DeltaCatalog`, Hudi's `HoodieCatalog`) only need to override methods where 
they want custom logic.
    
    `createTableLike` was added to `TableCatalog` in SPARK-33902 but the 
corresponding delegation in `DelegatingCatalogExtension` was not added. Without 
it, connectors extending `DelegatingCatalogExtension` that do not explicitly 
override `createTableLike` will hit the default 
`UnsupportedOperationException`, even if the underlying delegate catalog 
supports the operation.
    
    This is the same class of issue that was fixed in SPARK-42398 (#40369), 
where the `createTable(Column[])` overload was added to `TableCatalog` but the 
delegation in `DelegatingCatalogExtension` was missed.
    
    Note: `createTable(Identifier, TableInfo)` (added in 4.1.0) is 
intentionally *not* delegated here. Its default implementation in 
`TableCatalog` falls back to `createTable(ident, columns, partitions, 
properties)`, which is already delegated. Explicitly delegating 
`createTable(TableInfo)` would bypass subclass overrides of 
`createTable(Column[])`.
    
    ### Does this PR introduce _any_ user-facing change?
    No. `CREATE TABLE LIKE` for DSv2 is a new feature in Spark 4.2 and it's not 
been released yet.
    
    ### How was this patch tested?
    GA.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    Generated-by: Claude (via Kiro CLI, auto model selection)
    
    Closes #55979 from sarutak/fix-delegating-catalog-extension.
    
    Authored-by: Kousuke Saruta <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit b9bc899060644008a867c9887dd5b1ae82c70cc4)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../spark/sql/connector/catalog/DelegatingCatalogExtension.java    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/DelegatingCatalogExtension.java
 
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/DelegatingCatalogExtension.java
index 786821514822..421785568bb7 100644
--- 
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/DelegatingCatalogExtension.java
+++ 
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/DelegatingCatalogExtension.java
@@ -111,6 +111,13 @@ public abstract class DelegatingCatalogExtension 
implements CatalogExtension {
     return asTableCatalog().createTable(ident, columns, partitions, 
properties);
   }
 
+  @Override
+  public Table createTableLike(
+      Identifier ident, TableInfo tableInfo, Table sourceTable)
+      throws TableAlreadyExistsException, NoSuchNamespaceException {
+    return asTableCatalog().createTableLike(ident, tableInfo, sourceTable);
+  }
+
   @Override
   public Table alterTable(
       Identifier ident,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to