File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1818
1919package org .apache .paimon .flink .action ;
2020
21+ import org .apache .paimon .catalog .CachingCatalog ;
22+ import org .apache .paimon .catalog .Catalog ;
2123import org .apache .paimon .flink .clone .CloneHiveTableUtils ;
2224import org .apache .paimon .flink .clone .ClonePaimonTableUtils ;
25+ import org .apache .paimon .hive .HiveCatalog ;
2326
2427import javax .annotation .Nullable ;
2528
@@ -55,6 +58,18 @@ public CloneAction(
5558 String cloneFrom ) {
5659 super (sourceCatalogConfig );
5760
61+ if (cloneFrom .equalsIgnoreCase ("hive" )) {
62+ Catalog sourceCatalog = catalog ;
63+ if (sourceCatalog instanceof CachingCatalog ) {
64+ sourceCatalog = ((CachingCatalog ) sourceCatalog ).wrapped ();
65+ }
66+ if (!(sourceCatalog instanceof HiveCatalog )) {
67+ throw new UnsupportedOperationException (
68+ "Only support clone hive tables using HiveCatalog, but current source catalog is "
69+ + sourceCatalog .getClass ().getName ());
70+ }
71+ }
72+
5873 this .sourceDatabase = sourceDatabase ;
5974 this .sourceTableName = sourceTableName ;
6075 this .sourceCatalogConfig = sourceCatalogConfig ;
You can’t perform that action at this time.
0 commit comments