Zouxxyy commented on code in PR #4638:
URL: https://github.com/apache/paimon/pull/4638#discussion_r1869693211
##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java:
##########
@@ -254,6 +246,41 @@ public TableSchema createTable(Schema schema, boolean
ignoreIfExistsSame) throws
}
}
+ private TableSchema mergeSchemaForExternalTable(TableSchema oldSchema,
Schema newSchema)
Review Comment:
delta not accept new props, and its doc say:
```
When you run `CREATE TABLE` with a `LOCATION` that _already_ contains data
stored using <Delta>, <Delta> does the following:
- If you specify _only the table name and location_, for example:
CREATE TABLE default.people1 USING DELTA LOCATION '/tmp/delta/people'`
the table in the metastore automatically inherits the schema,
partitioning, and table properties of the existing data. This functionality can
be used to "import" data into the metastore.
- If you specify _any configuration_ (schema, partitioning, or table
properties), <Delta> verifies that the specification exactly matches the
configuration of the existing data.
.. important::
If the specified configuration does not _exactly_ match the
configuration of the data, <Delta> throws an exception that describes the
discrepancy.
```
here is the test result
```
create table delta2 using delta tblproperties ('k1' = 'v1') location
'/user/hive/warehouse/delta1';
[DELTA_CREATE_TABLE_WITH_DIFFERENT_PROPERTY] The specified properties do not
match the existing /user/hive/warehouse/delta1.
== Specified ==
k1=v1
== Existing ==
```
iceberg is weird, It has no inheritance at all and even create a new schema
at the same path
```
create table ice1 (id int) using iceberg;
desc table extended ice1;
id int
# Detailed Table Information
Name iceberg_catalog.test.ice1
Type MANAGED
Location /user/hive/warehouse/test.db/ice1
Provider iceberg
Owner root
Table Properties
[current-snapshot-id=none,format=iceberg/parquet,format-version=2,write.parquet.compression-codec=zstd]
create table ice2 using iceberg tblproperties ('k1' = 'v1') location
'/user/hive/warehouse/test.db/ice1';
desc table extended ice1;
# Detailed Table Information
Name iceberg_catalog.test.ice2
Type MANAGED
Location /user/hive/warehouse/test.db/ice1
Provider iceberg
Owner root
Table Properties
[current-snapshot-id=none,format=iceberg/parquet,format-version=2,k1=v1,write.parquet.compression-codec=zstd]
```
So let's go back to paimon, If we have a table create by flink paimon, and
want to create a new table location 'xxx' by spark paimon,
however spark paimon will add `{provider: paimon}` automaticly when creating
table, which conflicts with the existing options in the table. In this case,
should we discard this prop or add it (like PR) or throw exception(really don't
want it).
--
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]