jonvex commented on code in PR #12317:
URL: https://github.com/apache/hudi/pull/12317#discussion_r1856933800


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieCreateRecordUtils.scala:
##########
@@ -143,9 +143,12 @@ object HoodieCreateRecordUtils {
               avroRecWithoutMeta
             }
 
-            val hoodieRecord = if (shouldCombine && !precombineEmpty) {
-              val orderingVal = HoodieAvroUtils.getNestedFieldVal(avroRec, 
precombine,
-                false, 
consistentLogicalTimestampEnabled).asInstanceOf[Comparable[_]]
+            //TODO [HUDI-8574] we can throw exception if field doesn't exist
+            // lazy so that we don't evaluate if we short circuit the boolean 
expression in the if below
+            lazy val orderingVal = HoodieAvroUtils.getNestedFieldVal(avroRec, 
precombine,
+              true, 
consistentLogicalTimestampEnabled).asInstanceOf[Comparable[_]]

Review Comment:
   Actually, I still think it should be like this. We need to be fault tolerant 
for the case where the precombine field does not exist. 



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