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


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java:
##########
@@ -247,8 +208,18 @@ protected Option<Pair<T, Map<String, Object>>> 
doProcessNextDataRecord(T record,
             }
             Comparable incomingOrderingValue = readerContext.getOrderingValue(
                 Option.of(record), metadata, readerSchema, props);
-            if (compareTo(readerContext, incomingOrderingValue, 
existingOrderingValue) > 0) {
-              return Option.of(Pair.of(record, metadata));
+
+            try {
+              if (incomingOrderingValue.compareTo(existingOrderingValue) > 0) {
+                return Option.of(Pair.of(record, metadata));
+              }
+            } catch (ClassCastException e) {
+              throw new HoodieException(String.format(
+                  "Cannot compare values: %s(%s), %s(%s)",
+                  incomingOrderingValue,
+                  incomingOrderingValue.getClass(),
+                  existingOrderingValue,
+                  existingOrderingValue.getClass()));

Review Comment:
   In `MergeIntoHoodieTableCommand` you need to validate the input schema 
first.  If the schema is incompatible, the error should be thrown there.  
Deferring error here does not help user as this is not the root cause.



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