nikunjagarwal321 commented on code in PR #5404: URL: https://github.com/apache/hive/pull/5404#discussion_r1861409006
########## serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java: ########## @@ -559,7 +558,6 @@ public static StructField getStandardStructFieldRef(String fieldName, public static Field[] getDeclaredNonStaticFields(Class<?> c) { Field[] f = c.getDeclaredFields(); ArrayList<Field> af = new ArrayList<Field>(); Review Comment: Hey @kokila-19 , Saw your [comment](https://github.com/apache/hive/pull/5404#issuecomment-2496801034). Here's some more context on the issue and fix: Basically the above function called `getDeclaredFields()` [method](https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredFields--) where the order of fields is not defined and can be returned in any order. Multiple tests in serde modules were detected which were flaky, i.e. they may fail or pass sometimes based on the assumption that the order of getDeclaredFields will be same each time it is called. One of the test case is : `org.apache.hadoop.hive.serde2.objectinspector.TestThriftObjectInspectors.testThriftObjectInspectors` Others can be found on the ticket. Regarding the fix: We used this sorting of Fields based on the getSlotValue so that for a given input, the above function returns the fields in a given sorted order each time it is called. I understand that Java 17 has more restrictions on accessing private fields. I also saw that you added --add-opens flag in the main pom.xml file. Basically to fix this, we would want to **get the fields array in a fixed deterministic order**(may be via sorting) rather than relying on the non deterministic behaviour of getDeclaredFields(). We can research more and check how this can be implemented in Java 17(may be adding --add-opens flag to other module or by sorting with some other attribute so that the order . -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org