szehon-ho commented on code in PR #17954:
URL: https://github.com/apache/iceberg/pull/17954#discussion_r4170658881
##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:
##########
@@ -250,6 +251,33 @@ public Table createTable(Identifier ident, TableInfo info)
}
}
+ @Override
+ public Table createTableLike(Identifier ident, TableInfo tableInfo, Table
sourceTable)
+ throws TableAlreadyExistsException, NoSuchNamespaceException {
+ checkViewNotExists(ident);
+
+ String provider = tableInfo.properties().get("provider");
+ if (provider == null) {
+ provider = sourceTable.properties().get("provider");
+ }
+
+ if (useIceberg(provider)) {
+ return icebergCatalog.createTableLike(ident, tableInfo, sourceTable);
+ } else {
+ Map<String, String> properties =
Maps.newHashMap(sourceTable.properties());
+ properties.remove(TableCatalog.PROP_LOCATION);
Review Comment:
Please remove `TableCatalog.PROP_EXTERNAL` along with the source location
before applying the target properties. A source created with `CREATE EXTERNAL
TABLE … USING iceberg LOCATION …` retains `external=true`; cloning it with
`USING parquet` and no target `LOCATION` then fails because Spark requires a
location for an external table. Please add coverage for this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]