acvictor commented on code in PR #11618:
URL: 
https://github.com/apache/incubator-gluten/pull/11618#discussion_r2882446383


##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:
##########
@@ -161,7 +161,7 @@ class VeloxIteratorApi extends IteratorApi with Logging {
               case _: DateType =>
                 DateFormatter.apply().format(pv.asInstanceOf[Integer])
               case _: DecimalType =>
-                pv.asInstanceOf[Decimal].toJavaBigInteger.toString
+                
pv.asInstanceOf[Decimal].toJavaBigDecimal.unscaledValue().toString

Review Comment:
   It's not that it's unsupported but rather results in incorrect casting (see 
https://github.com/apache/incubator-gluten/pull/11618). The change is needed 
because `Decimal.toJavaBigInteger` truncates the fractional part, producing an 
incorrect unscaled value. For example, a Decimal("100.1") with scale=1 would 
serialize as "100" (the truncated BigInteger) instead of "1001" (the correct 
unscaled representation). This causes Velox reader to misinterpret decimal 
partition values, returning wrong query results.



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