harshitsingh070 opened a new issue, #813:
URL: https://github.com/apache/wayang/issues/813

   ## Description
   
   `Record.compareTo()` throws a `ClassCastException` when comparing records 
containing `Comparable` values.
   
   The issue occurs because `Record.values` is an `Object[]`, but `compareTo()` 
attempts to cast the entire array to `Comparable[]`.
   
   ## Location
   
   
`wayang-commons/wayang-basic/src/main/java/org/apache/wayang/basic/data/Record.java`
   
   Around lines 184-185.
   
   ## Steps to Reproduce
   
   ```java
   Record first = new Record(1, 2);
   Record second = new Record(1, 2);
   
   first.compareTo(second);
   ```
   
   This results in a `ClassCastException`.
   
   ## Expected Behavior
   
   `Record.compareTo()` should compare the record values without throwing a 
`ClassCastException`.
   
   For the example above, comparing two equal records should return `0`.
   
   ## Proposed Solution
   
   Compare the record values element-by-element instead of casting the entire 
`Object[]` to `Comparable[]`.
   
   I have implemented a fix locally and added regression tests covering equal 
records, ordering, tie-breaking, single-field records, and dissimilar field 
types.


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