yihua opened a new issue, #20386:
URL: https://github.com/apache/hudi/issues/20386

   **Describe the problem you faced**
   
   Hudi's Avro-based parquet reader (`HoodieAvroParquetReader` in 
hudi-hadoop-common, and the Hive reader in hudi-hadoop-mr that is built on it) 
returns wrong values for decimal columns that a parquet file stores as INT32 or 
INT64. Spark, Iceberg, Trino, DuckDB and parquet-rs all write decimals of 
precision up to 18 that way, so a file produced by any of them and read through 
this path (Hive, the Java client, utilities using Avro records, schema-on-read) 
comes back with the unscaled integer treated as the value: 17.00 reads as 
1700.00, with no error.
   
   The cause is parquet-avro: its schema converter keeps the DECIMAL annotation 
only on BINARY and FIXED_LEN_BYTE_ARRAY columns, so an INT64 decimal surfaces 
to Avro as a plain `long`. Hudi then promotes that long to the table's decimal 
type as if it were the value. The Spark reader and hudi-rs read the same files 
correctly.
   
   **Expected behavior**
   
   INT32 and INT64 decimal columns read back with their declared precision and 
scale through every Hudi reader, and a shape the Avro reader cannot handle 
fails loudly instead of returning wrong numbers.
   
   **Environment Description**
   
   * Hudi version : master (1.3.0-SNAPSHOT), also affects 1.x releases
   * Spark version : n/a (Avro reader path)
   * Storage (HDFS/S3/GCS..) : any
   


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