Skip to content

Remove redundant table properties when KSHC create table#7406

Closed
maomaodev wants to merge 3 commits intoapache:masterfrom
maomaodev:kyuubi-6443
Closed

Remove redundant table properties when KSHC create table#7406
maomaodev wants to merge 3 commits intoapache:masterfrom
maomaodev:kyuubi-6443

Conversation

@maomaodev
Copy link
Copy Markdown
Contributor

@maomaodev maomaodev commented Apr 16, 2026

Why are the changes needed?

Fixed #6443. When creating an external table via KSHC with EXTERNAL and LOCATION specified, the KSHC table properties will include external=true(lowercase). Meanwhile, Hive Metastore automatically appends EXTERNAL=TRUE (uppercase). On some metastore backends (e.g. MySQL with a case-insensitive collation), this leads to a duplicate primary key conflict in TABLE_PARAMS.

This PR removes redundant table properties when KSHC creates tables. For example, the external property will be excluded.

How was this patch tested?

UT

Was this patch authored or co-authored using generative AI tooling?

No

@pan3793
Copy link
Copy Markdown
Member

pan3793 commented Apr 16, 2026

how does this happen for SQL cases? I thought it should be handled by AstBuilder.cleanTableProperties, but it doesn't seem to be? could you please summarize the whole flow of the properties propagation?

@maomaodev
Copy link
Copy Markdown
Contributor Author

how does this happen for SQL cases? I thought it should be handled by AstBuilder.cleanTableProperties, but it doesn't seem to be? could you please summarize the whole flow of the properties propagation?

  1. SQL case reference: [Bug] Kyuubi Hive Connector Can not Create External Table #6443. The simplest example is:
CREATE EXTERNAL TABLE kyuubi_catalog.database.table_1 (
    column1 string
)
LOCATION 'hdfs:///tmp/table_1';
  1. In the parse phase, AstBuilder.cleanTableProperties is responsible for filtering/intercepting reserved properties from TBLPROPERTIES. For example, you cannot set reserved properties via TBLPROPERTIES (e.g., trying to use TBLPROPERTIES ('provider'='test') is not allowed).

  2. In the physical plan phase, before CreateTableExec calls catalog.createTable(...), it invokes CatalogV2Util.convertTableProperties, which unify all properties (properties, options, serde, location, external, provider, etc.). The resulting map is passed as the properties argument to KSHC’s HiveTableCatalog.createTable. See: [SPARK-31257][SPARK-33561][SQL] Unify create table syntax spark#28026

@pan3793 pan3793 added this to the v1.12.0 milestone Apr 16, 2026
@pan3793 pan3793 closed this in e2ea980 Apr 16, 2026
@pan3793
Copy link
Copy Markdown
Member

pan3793 commented Apr 16, 2026

thanks, merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Kyuubi Hive Connector Can not Create External Table

2 participants