Skip to content

Commit a299385

Browse files
committed
fixed PrimitiveValues comparisons
1 parent c5b7231 commit a299385

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

table/src/main/java/tech/ydb/table/values/PrimitiveValue.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,35 @@ public int compareTo(Value<?> other) {
499499
case Yson:
500500
return compareByteArrays(getBytesUnsafe(), otherPrimitive.getBytesUnsafe());
501501
case Text:
502+
return getText().compareTo(otherPrimitive.getText());
502503
case Json:
504+
return getJson().compareTo(otherPrimitive.getJson());
503505
case JsonDocument:
504-
return getText().compareTo(otherPrimitive.getText());
506+
return getJsonDocument().compareTo(otherPrimitive.getJsonDocument());
505507
case Uuid:
506508
return getUuidJdk().compareTo(otherPrimitive.getUuidJdk());
507509
case Date:
508-
case Date32:
509510
return getDate().compareTo(otherPrimitive.getDate());
511+
case Date32:
512+
return getDate32().compareTo(otherPrimitive.getDate32());
510513
case Datetime:
511-
case Datetime64:
512514
return getDatetime().compareTo(otherPrimitive.getDatetime());
515+
case Datetime64:
516+
return getDatetime64().compareTo(otherPrimitive.getDatetime64());
513517
case Timestamp:
514-
case Timestamp64:
515518
return getTimestamp().compareTo(otherPrimitive.getTimestamp());
519+
case Timestamp64:
520+
return getTimestamp64().compareTo(otherPrimitive.getTimestamp64());
516521
case Interval:
517-
case Interval64:
518522
return getInterval().compareTo(otherPrimitive.getInterval());
523+
case Interval64:
524+
return getInterval64().compareTo(otherPrimitive.getInterval64());
519525
case TzDate:
526+
return getTzDate().compareTo(otherPrimitive.getTzDate());
520527
case TzDatetime:
528+
return getTzDatetime().compareTo(otherPrimitive.getTzDatetime());
521529
case TzTimestamp:
522-
return getTzDate().compareTo(otherPrimitive.getTzDate());
530+
return getTzTimestamp().compareTo(otherPrimitive.getTzTimestamp());
523531
default:
524532
throw new UnsupportedOperationException("Comparison not supported for type: " + getType());
525533
}

0 commit comments

Comments
 (0)