fuyufjh opened a new issue, #12631:
URL: https://github.com/apache/iceberg/issues/12631

   ### Apache Iceberg version
   
   1.8.1 (latest release)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   As defined in the [Open API 
spec](https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml)
 of REST catalog API, some of the `int64` fields were encoded as number in JSON 
format, for example, the `snapshot-id`:
   
   
https://github.com/apache/iceberg/blob/f12d200108cc95b38fe0edd9113f807b47648656/open-api/rest-catalog-open-api.yaml#L2399-L2401
   
   However, as a subset of JavaScript, JSON cannot preserve the precision of 
any int64 numbers larger than 
[`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER),
 which is easy to violate if the ID contains timestamp or UUID, etc.
   
   An easy way to reproduce this problem is to run 
[iceberg-rest-image](https://github.com/databricks/iceberg-rest-image) and then 
create a table and insert some data. Then, call the `loadTable` API and you 
will get something like
   
   ```
   { ...
      "snapshots": [
         {
           "sequence-number": 1,
           "snapshot-id": 4.5982866113522427e+18,
           "timestamp-ms": 1742207119327,
           ...
         }
       ], ...
   }
   ```
   
   This problem also exists for the JSON file in warehouse, for 
   
[example](https://github.com/user-attachments/files/19427357/00000-447dcfb8-3ada-4ad7-8b10-d9ec26eabb61.metadata.json).
 Although the number *looks* normal, it violates the JSON standard. Depends on 
the implementation, many JSON parsers will not produce correct results.
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


-- 
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: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to