hudi-agent commented on code in PR #20305:
URL: https://github.com/apache/hudi/pull/20305#discussion_r4266952968


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/cdc/InternalRowToJsonStringConverter.scala:
##########
@@ -95,6 +99,11 @@ class InternalRowToJsonStringConverter(schema: StructType) {
               structMap.toMap
             case _ => value // fallback
           }
+        case _: DecimalType => value.asInstanceOf[Decimal].toJavaBigDecimal
+        case DateType => LocalDate.ofEpochDay(value.asInstanceOf[Int]).toString
+        case TimestampType => 
DateTimeUtils.microsToInstant(value.asInstanceOf[Long]).toString
+        case dt if dt.typeName == 
InternalRowToJsonStringConverter.TIMESTAMP_NTZ_TYPE_NAME =>
+          
DateTimeUtils.microsToLocalDateTime(value.asInstanceOf[Long]).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)

Review Comment:
   🤖 nit: could you move the long `ISO_LOCAL_DATE_TIME` formatting into a small 
helper or a shared `DateTimeFormatter` constant? `LocalDateTime.toString` may 
also drop seconds when zero, so a named formatter makes the intent clearer.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/cdc/CDCFileGroupIterator.scala:
##########
@@ -664,7 +667,8 @@ class CDCFileGroupIterator(split: HoodieCDCFileGroupSplit,
     if (record == null) {
       null
     } else {
-      convertToUTF8String(HoodieCDCUtils.recordToJson(record))
+      val row = 
inlineCdcImageDeserializer.deserialize(record).get.asInstanceOf[InternalRow]

Review Comment:
   🤖 nit: `recordToJsonAsUTF8String` no longer produces JSON via Avro; could 
you rename it (e.g. `inlineAvroImageToJson`) so it reads consistently with 
`inlineCdcImageDeserializer`?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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