[
https://issues.apache.org/jira/browse/TINKERPOP-3173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18019697#comment-18019697
]
ASF GitHub Bot commented on TINKERPOP-3173:
-------------------------------------------
Cole-Greer commented on code in PR #3195:
URL: https://github.com/apache/tinkerpop/pull/3195#discussion_r2342430101
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/GremlinValueComparator.java:
##########
@@ -331,17 +307,70 @@ private static boolean naturallyComparable(final Object
f, final Object s) {
/**
* Return true if the two objects are of the same comparison type
(although they may not be the exact same Class)
*/
- private static boolean comparable(final Object f, final Object s) {
+ public static boolean comparable(final Object f, final Object s) {
if (f == null || s == null)
return f == s; // true iff both in the null space
+ if (eitherAreNaN(f, s))
+ return false;
+
final Type ft = Type.type(f);
final Type st = Type.type(s);
+ // if objects are collections or composites, their contents must be
mutually comparable
+ if (ft == Type.List && st == Type.List) {
Review Comment:
Great catch. Under the original TBL semantics arrays and Lists were mutually
comparable. That was missing here. I've updated Type.List to now encompass
arrays, and updated the associated comparator to handle iterators from either
List or Arrays.
> Simplify Comparability Semantics
> --------------------------------
>
> Key: TINKERPOP-3173
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3173
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.7.3
> Reporter: Cole Greer
> Priority: Major
>
> As recently discussed on the
> [devlist|https://lists.apache.org/thread/hsqw2tvc72dw4z40nnbbdmygrqx43syr],
> our current system of ternary boolean logic should be simplified to binary
> boolean logic where invalid comparisons simply return false.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)