LauraXia123 opened a new pull request, #12339:
URL: https://github.com/apache/gravitino/pull/12339

   ### What changes were proposed in this pull request?
   
   This PR enhances the `CreateTableDialog` for ClickHouse table creation with 
two features:
   
   **1. Support ClickHouse data-skipping index types with properties**
   
   - Add **Granularity** column in the Indexes tab, shown for data-skipping 
index types (`data_skipping_minmax`, `data_skipping_bloom_filter`, 
`data_skipping_set`), hidden (`-`) for `primary_key`
   - Add **Set Max Values** column, shown only for `data_skipping_set` index 
type
   - Populate `granularity` and `set_max_values` when editing an existing table
   - Include index `properties` object in the submit payload for data-skipping 
indexes
   - Clear granularity/setMaxValues fields when index type changes
   
   **2. Engine-aware sort orders validation**
   
   - Add `clickHouseEngine` and `isClickHouseMergeTreeEngine` computed 
variables to detect the current engine type in real-time
   - Show required indicator (`*`) on Sort Orders tab only for MergeTree family 
engines
   - Move sort orders validation from `Form.Item rules` (which can cache stale 
closure values) to `handleSubmit` where `form.getFieldValue('engine')` reads 
the current engine value
   - Add `useEffect` on `isClickHouseMergeTreeEngine` to:
     - Clear sort orders data and validation errors when switching to 
non-MergeTree engines
     - Show required validation error when switching to MergeTree engines with 
empty sort orders
   - Remove `validateTrigger='onSubmit'` and `rules` from sortOrders 
`Form.Item` to avoid Ant Design Form caching stale validator closures
   
   ### Why are the changes needed?
   
   1. ClickHouse data-skipping indexes require `granularity` and 
`set_max_values` properties to be configured. Without these fields in the UI, 
users cannot properly create data-skipping indexes through the Gravitino web 
interface.
   
   2. Sort orders are only required for MergeTree family engines. For other 
ClickHouse engines (Distributed, TinyLog, Log, StripeLog), sort orders are 
optional. The previous implementation always validated sort orders as required 
regardless of engine type, causing form submission to fail for non-MergeTree 
engines when sort orders were empty.
   
   Fix: #12337
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes:
   1. **Indexes tab**: Two new columns (Granularity, Set Max Values) are added 
for ClickHouse tables. These columns show `-` for non-data-skipping index types.
   2. **Sort Orders tab**: The required indicator (`*`) now dynamically 
appears/disappears based on the selected ClickHouse engine type. Sort orders 
are only required for MergeTree family engines.
   3. **Engine switch**: Switching from a MergeTree engine to a non-MergeTree 
engine now clears sort orders data and validation errors automatically.
   
   ### How was this patch tested?
   
   1. Create a ClickHouse table with MergeTree engine - verify Sort Orders tab 
shows `*` and validation requires at least one sort order
   2. Switch engine from MergeTree to TinyLog/Log/StripeLog/Distributed - 
verify `*` disappears, sort orders data is cleared, and form can be submitted 
without sort orders
   3. Switch engine back to MergeTree - verify `*` reappears and validation 
error shows if sort orders are empty
   4. Create a table with `data_skipping_minmax` index - verify Granularity 
field is shown, Set Max Values shows `-`
   5. Create a table with `data_skipping_set` index - verify both Granularity 
and Set Max Values fields are shown
   6. Create a table with `primary_key` index - verify both Granularity and Set 
Max Values show `-`
   7. Edit an existing table with data-skipping indexes - verify granularity 
and set_max_values are populated correctly
   8. Submit a table with data-skipping index properties - verify properties 
are included in the API payload


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