jiangxt2 opened a new issue, #11880:
URL: https://github.com/apache/gravitino/issues/11880

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   The ClickHouse catalog's write path correctly generates a `SETTINGS` clause 
from table
   properties (using the `settings.` key prefix), but the read path never 
parses SETTINGS
   back into table properties. This causes SETTINGS to be lost on table 
round-trip.
   
   The write path (`appendTableProperties`, lines 242-265) filters properties 
with `settings.`
   prefix and emits `SETTINGS key = value` in CREATE TABLE SQL — this works 
correctly.
   However, the read path (`getTableProperties`, line 528) queries 
`system.tables` but only
   extracts COMMENT, ENGINE, and cluster metadata. No SETTINGS are read. 
Additionally,
   `parseCreateStatement` (line 1088) uses SETTINGS solely as a regex boundary 
and discards
   its content.
   
   ### Error message and/or stacktrace
   
   N/A. Found via code review. No runtime error — SETTINGS are silently dropped.
   
   ### How to reproduce
   
   1. Create a table in ClickHouse with custom SETTINGS:
      ```sql
      CREATE TABLE test_settings (id Int64, name String)
      ENGINE=MergeTree ORDER BY id SETTINGS index_granularity = 4096;
      ```
   2. Verify ClickHouse stored the setting: `SHOW CREATE TABLE test_settings` 
shows
      `SETTINGS index_granularity = 4096`
   3. Load the table via Gravitino REST API and inspect the `properties` map
   4. Expected: properties contains `settings.index_granularity = 4096`
   5. Actual: properties contains only `engine = MergeTree`, `on-cluster = 
false`,
      `COMMENT = ` — no `settings.*` keys
   
   ### Additional context
   
   - `ClickHouseTableOperations.java`:242-265 — write path (working)
   - `ClickHouseTableOperations.java`:528-582 — `getTableProperties` (missing 
SETTINGS)
   - `ClickHouseTableOperations.java`:1088-1128 — `parseCreateStatement` 
(SETTINGS discarded)
   - `ShowCreateTableMetadata` inner class (line 1228) only has `partitioning` 
and `sortOrders`
   - Fix: parse SETTINGS from `SHOW CREATE TABLE` output (similar to how ORDER 
BY / PARTITION BY
     are already parsed in `parseCreateStatement`), or read `engine_full` from 
`system.tables`
     which embeds the SETTINGS clause as a string suffix. Note: `system.tables` 
has no dedicated
     `settings` column — the data is only available as part of the DDL string 
in `create_table_query`
     or `engine_full`.
   


-- 
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]

Reply via email to