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


##########
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:
   I was trying to add validation that the precombine existed but decided 
against it for this pr due to backwards compatibility and scope creep of this 
pr. So this made sense when that other code was here. But now we can just pull 
it into the if



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