Github user YehEmily commented on a diff in the pull request: https://github.com/apache/geode/pull/580#discussion_r122067285 --- Diff: geode-core/src/main/java/org/apache/geode/cache/query/internal/OrderByComparator.java --- @@ -228,4 +139,55 @@ void addEvaluatedSortCriteria(Object row, ExecutionContext context) // No op } + private int compareHelperMethod(Object obj1, Object obj2) { + if (obj1 == null || obj2 == null) { + return compareIfOneOrMoreNull(obj1, obj2); + } else if (obj1 == QueryService.UNDEFINED || obj2 == QueryService.UNDEFINED) { + return compareIfOneOrMoreQueryServiceUndefined(obj1, obj2); + } else { + return compareTwoObjects(obj1, obj2); + } + } + + private int compareIfOneOrMoreNull(Object obj1, Object obj2) { + if (obj1 == null) { + return obj2 == null ? 0 : -1; + } else { + return 1; + } + } + + private int compareIfOneOrMoreQueryServiceUndefined(Object obj1, Object obj2) { + if (obj1 == QueryService.UNDEFINED) { + return obj2 == QueryService.UNDEFINED ? 0 : -1; + } else { + return 1; + } + } + + private int compareTwoObjects(Object obj1, Object obj2) { + if (obj1 instanceof Number && obj2 instanceof Number) { + return compareTwoNumbers(obj1, obj2); + } else { + return compareTwoStrings(obj1, obj2); + } + } + + private int compareTwoNumbers(Object obj1, Object obj2) { --- End diff -- Oh no, that's very true! I'll fix this and update the PR!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---