nikunjagarwal321 commented on code in PR #5527:
URL: https://github.com/apache/hive/pull/5527#discussion_r1835273794


##########
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java:
##########
@@ -1652,4 +1654,20 @@ public static boolean 
hasAllFieldsSettable(ObjectInspector oi,
   private ObjectInspectorUtils() {
     // prevent instantiation
   }
+
+  /**
+   * Returns slot value used for ordering the fields to make it deterministic
+   * @param field : field of a given class
+   * @return
+   */
+  private static int getSlotValue(Field field) {
+    try {
+      Field slotField = Field.class.getDeclaredField("slot");
+      slotField.setAccessible(true);
+      return slotField.getInt(field);
+    } catch (NoSuchFieldException | IllegalAccessException | 
IllegalArgumentException e) {
+      LOG.info("Field not found: {}", e);

Review Comment:
   Agreed, basically the change is to make the function deterministic so that 
the mentioned tests are not flaky anymore. As you said, returning 0 can still 
return random order as it means equality. 
   I'll have changed this to throw a new RuntimeException(similar to the 
exceptions used in other parts of the class) with the same error message.



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

Reply via email to