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

   ### Version
   
   main branch (01eb0c277)
   
   ### Describe what's wrong
   
   1. `add-spec` whose partition fields carry no `field-id` returns 400 "field 
id 1000 is already used". The REST spec makes `field-id` optional and the table 
spec says new ids are assigned from `last-partition-id` (reusing the id of an 
equivalent field). Iceberg's builder numbers such fields from 1000 again, and 
the commit validation correctly refuses the collision, so the request fails 
instead of being numbered.
   2. On a v3 table holding data, `add-schema` changing a `date` column to 
`timestamp` or `timestamp_ns` returns 400. The v3 table spec allows both 
promotions; Iceberg 1.11's `TypeUtil.isPromotionAllowed`, which the commit 
validation uses, does not implement them.
   3. `POST .../tables` with a `decimal(10, 11)` column returns 400 from 
Gravitino's type conversion (`Decimal scale must be in range [0, precision 
(10)]`) after Iceberg has already created the table, so the table exists in the 
IRC, is unowned and cannot be loaded through Gravitino.
   
   ### How to reproduce
   
   Set `IRC` to the catalog base URL (`http://host:9001/iceberg/v1/cat`) and 
`AUTH` to curl credentials, with namespace `ns` existing.
   
   ```bash
   # 1. partitioned v2 table, then add-spec without field ids
   curl -s -u "$AUTH" -X POST "$IRC/namespaces/ns/tables" -H 'Content-Type: 
application/json' -d 
'{"name":"t1","schema":{"type":"struct","fields":[{"id":1,"name":"id","type":"long","required":false},{"id":2,"name":"s","type":"string","required":false}]},"partition-spec":{"fields":[{"name":"s","transform":"identity","source-id":2}]},"properties":{"format-version":"2"}}'
 >/dev/null
   curl -s -w '%{http_code}\n' -u "$AUTH" -X POST 
"$IRC/namespaces/ns/tables/t1" -H 'Content-Type: application/json' -d 
'{"requirements":[],"updates":[{"action":"add-spec","spec":{"fields":[{"name":"s","transform":"identity","source-id":2},{"name":"id_b","transform":"bucket[4]","source-id":1}]}}]}'
   # expected 200 with field ids 1000 and 1001; actual 400
   
   # 3. decimal(10, 11)
   curl -s -w '%{http_code}\n' -u "$AUTH" -X POST "$IRC/namespaces/ns/tables" 
-H 'Content-Type: application/json' -d 
'{"name":"t3","schema":{"type":"struct","fields":[{"id":1,"name":"d","type":"decimal(10,
 11)","required":false}]}}'
   curl -s -o /dev/null -w '%{http_code}\n' -u "$AUTH" 
"$IRC/namespaces/ns/tables/t3"
   # expected 400 and then 404; actual 400 and then 200 (the table was created)
   ```
   
   Case 2: create a v3 table with `d date`, append a data file, then commit 
`add-schema` with `d` as `timestamp`: expected 200, actual 400.
   
   ### Additional context
   
   Found by retesting the fixes from #14438 and #14444.


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