amogh-jahagirdar commented on code in PR #13692:
URL: https://github.com/apache/iceberg/pull/13692#discussion_r2246174437


##########
core/src/main/java/org/apache/iceberg/variants/Variants.java:
##########
@@ -186,16 +186,17 @@ public static VariantPrimitive<Long> 
ofIsoTimestampntz(String value) {
   }
 
   public static VariantPrimitive<BigDecimal> of(BigDecimal value) {
-    int bitLength = value.unscaledValue().bitLength();
-    if (bitLength < 32) {
+    int precision = value.precision();
+
+    if (precision >= 1 && precision <= 9) {

Review Comment:
   Yeah this change makes sense to me, my understanding is the parquet physical 
type must be determined based on `precision`, because the precision is 
ultimately what the physical value needs to store. I can see how there are 
cases where the required amount of bits to represent an unscaled value is less 
but we still need a higher precision for storing the decimal and preserving the 
semantic value



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to