yihua commented on code in PR #12993:
URL: https://github.com/apache/hudi/pull/12993#discussion_r2001887764


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ColumnStatsIndexSupport.scala:
##########
@@ -490,13 +491,19 @@ object ColumnStatsIndexSupport {
       case ShortType => value.asInstanceOf[Int].toShort
       case ByteType => value.asInstanceOf[Int].toByte
 
-      // TODO fix
-      case _: DecimalType =>
+      case dt: DecimalType =>
         value match {
           case buffer: ByteBuffer =>
-            val logicalType = 
DecimalWrapper.SCHEMA$.getField("value").schema().getLogicalType
-            decConv.fromBytes(buffer, null, logicalType)
-          case _ => value
+            // Use the DecimalType's precision and scale (instead of using the 
schema from DecimalWrapper)

Review Comment:
   My understanding is that this only affects reading the column stats from 
MDT, not writing, so there is no storage byte change.  Correct?



##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ColumnStatsIndexSupport.scala:
##########
@@ -455,10 +456,10 @@ object ColumnStatsIndexSupport {
       case w: LongWrapper => w.getValue
       case w: FloatWrapper => w.getValue
       case w: DoubleWrapper => w.getValue
+      case w: DecimalWrapper => w.getValue  // Moved above BytesWrapper to 
ensure proper matching

Review Comment:
   Do we have functional tests covering the data skipping on a decimal column 
using column stats?



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