jiangxt2 commented on PR #11731:
URL: https://github.com/apache/gravitino/pull/11731#issuecomment-4767585906

   Thank you for the thorough review. I have pushed a new commit (`dc9cc3d88`) 
addressing all 8 comments.
   
   **Comment-by-comment response**
   
   **line 920 — PRIMARY_KEY/UNIQUE_KEY limitation**: Already replied. This 
applies to all Doris versions. `PRIMARY_KEY` and `UNIQUE_KEY` belong to 
`KeysType` (table data model), not `IndexType` (index types). The 
`UnsupportedOperationException` is a defensive guard.
   
   **line 316 — PRIMARY_KEY validation/generation mismatch**: Fixed. 
`appendTableModelKeySql` now handles both `UNIQUE_KEY` and `PRIMARY_KEY` index 
types, both emitting `UNIQUE KEY(col)`. Doris Nereids parser (4.0.x) does not 
accept `PRIMARY KEY(col)` syntax in CREATE TABLE; the PRIMARY KEY model is 
functionally equivalent to UNIQUE KEY in Doris.
   
   **line 104 — AUTO_INCREMENT version guard**: Fixed. Added 
`validateAutoIncrementVersion()` — queries `SELECT VERSION()` and rejects 
AUTO_INCREMENT if Doris server < 2.1.0. Clear error message: *"AUTO_INCREMENT 
requires Doris 2.1.0 or later. Current server version: X.Y.Z"*.
   
   **line 302/530 — BITMAP→INVERTED hardcoded, read/write asymmetry**: Fixed. 
`mapDorisIndexType` now returns `INVERTED` for BITMAP, matching the write path. 
On the 1.2.x concern: we chose read-write consistency over version detection. 
If you prefer version-aware branching, I can add it in a follow-up PR.
   
   **line 520 — null Index_type default**: Fixed. Now returns `UNIQUE_KEY` 
instead of `INVERTED` for non-PRIMARY indexes when `Index_type` is absent 
(Doris 1.2.x), matching the BTREE case.
   
   **line 343 — UNIQUE KEY ordered prefix constraint**: Documented in Javadoc: 
*"Doris requires key columns to be an ordered prefix of the schema. The caller 
must ensure the key column is the first column in the table definition."*
   
   **line 36 — Test matrix missing 4.0.6**: Fixed. Added `VERSION_4_0` to 
`DorisImageName` enum + new `CatalogDoris4xIT` integration test class covering 
4.0.x specific features (INVERTED index, ADD/DROP INDEX, AUTO_INCREMENT, UNIQUE 
KEY model, BITMAP read-back mapping).
   
   **line 90 — Redundant debug logging**: Fixed. Simplified to `name={}, 
type={}`.
   
   **Version compatibility**
   
   - INVERTED index: Experimental on 1.2.x, GA in 2.0+
   - BITMAP index: Default (no USING) on 1.2.x; `USING BITMAP` on 3.0.x; 
removed from Nereids grammar on 4.0.x, mapped to INVERTED
   - AUTO_INCREMENT: Not supported on 1.2.x (parser error); supported on 3.0.x 
/ 4.0.x
   - UNIQUE KEY model: Not supported on 1.2.x; supported on 3.0.x / 4.0.x
   - ANN/VECTOR index: Supported on 4.0.6+
   
   **Test results**
   
   ```
   Unit tests (TestDorisTableOperationsSqlGeneration): 12/12 ✅
   CatalogDoris3xIT (Doris 3.0.6.2):                  5/5  ✅
   CatalogDoris4xIT (Doris 4.0.6):                    5/5  ✅
   ```
   
   ---
   
   感谢详细的 review。我已推送新 commit(`dc9cc3d88`)修复了全部 8 条评论。
   
   **逐条回应**
   
   **line 920 — PRIMARY_KEY/UNIQUE_KEY 限制**:已回复。此限制适用于所有 Doris 版本。`PRIMARY_KEY` 
和 `UNIQUE_KEY` 属于 `KeysType`(表数据模型),不属于 
`IndexType`(索引类型)。`UnsupportedOperationException` 是防御性守卫。
   
   **line 316 — PRIMARY_KEY 验证/生成不匹配**:已修复。`appendTableModelKeySql` 现在同时处理 
`UNIQUE_KEY` 和 `PRIMARY_KEY`,均生成 `UNIQUE KEY(col)`。Doris Nereids 解析器(4.0.x)不接受 
`PRIMARY KEY(col)` 语法;PRIMARY KEY 模型在 Doris 中与 UNIQUE KEY 功能等价。
   
   **line 104 — AUTO_INCREMENT 版本守卫**:已修复。新增 `validateAutoIncrementVersion()` 
—— 查询 `SELECT VERSION()`,Doris 版本 < 2.1.0 时拒绝 
AUTO_INCREMENT,错误信息:*"AUTO_INCREMENT requires Doris 2.1.0 or later. Current 
server version: X.Y.Z"*。
   
   **line 302/530 — BITMAP→INVERTED 硬编码,读写不对称**:已修复。`mapDorisIndexType` 现在对 
BITMAP 返回 `INVERTED`,与写路径一致。关于 1.2.x 的顾虑:我们选择了读写一致性而非版本检测。如果你倾向于版本感知分支,我可以在后续 
PR 中补充。
   
   **line 520 — null Index_type 默认值**:已修复。当 `Index_type` 不存在时(Doris 1.2.x),非 
PRIMARY 索引现在返回 `UNIQUE_KEY`(而非 `INVERTED`),与 BTREE 分支行为一致。
   
   **line 343 — UNIQUE KEY 有序前缀约束**:已在 Javadoc 中标注:*"Doris 要求 key columns 是 
schema 的有序前缀,调用方必须确保 key column 是表定义中的第一列。"*
   
   **line 36 — 测试矩阵缺 4.0.6**:已修复。在 `DorisImageName` 枚举中新增 `VERSION_4_0` + 新增 
`CatalogDoris4xIT` 集成测试类,覆盖 4.0.x 特有功能(INVERTED 索引、ADD/DROP 
INDEX、AUTO_INCREMENT、UNIQUE KEY 模型、BITMAP 读回映射)。
   
   **line 90 — 冗余 debug 日志**:已修复,精简为 `name={}, type={}`。
   
   **版本兼容性**
   
   - INVERTED 索引:1.2.x 为实验性,2.0+ 为 GA
   - BITMAP 索引:1.2.x 默认(无 USING);3.0.x 支持 `USING BITMAP`;4.0.x 已从 Nereids 
语法移除,映射为 INVERTED
   - AUTO_INCREMENT:1.2.x 不支持(parser 报错);3.0.x / 4.0.x 支持
   - UNIQUE KEY 模型:1.2.x 不支持;3.0.x / 4.0.x 支持
   - ANN/VECTOR 索引:4.0.6+ 支持
   
   **测试结果**
   
   ```
   单元测试 (TestDorisTableOperationsSqlGeneration): 12/12 ✅
   CatalogDoris3xIT (Doris 3.0.6.2):                5/5  ✅
   CatalogDoris4xIT (Doris 4.0.6):                  5/5  ✅
   ```


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