dcapwell commented on code in PR #2310:
URL: https://github.com/apache/cassandra/pull/2310#discussion_r1194166979


##########
test/unit/org/apache/cassandra/utils/AbstractTypeGenerators.java:
##########
@@ -72,42 +103,271 @@
               TypeSupport.of(LongType.instance, SourceDSL.longs().all()),
               TypeSupport.of(FloatType.instance, SourceDSL.floats().any()),
               TypeSupport.of(DoubleType.instance, SourceDSL.doubles().any()),
-              TypeSupport.of(BytesType.instance, Generators.bytes(1, 1024)),
+              TypeSupport.of(BytesType.instance, Generators.bytes(0, 1024), 
FastByteOperations::compareUnsigned), // use the faster version...
               TypeSupport.of(UUIDType.instance, Generators.UUID_RANDOM_GEN),
-              TypeSupport.of(InetAddressType.instance, 
Generators.INET_ADDRESS_UNRESOLVED_GEN), // serialization strips the hostname, 
only keeps the address
-              TypeSupport.of(AsciiType.instance, 
SourceDSL.strings().ascii().ofLengthBetween(1, 1024)),
-              TypeSupport.of(UTF8Type.instance, Generators.utf8(1, 1024)),
+              TypeSupport.of(TimeUUIDType.instance, 
Generators.UUID_TIME_GEN.map(TimeUUID::fromUuid)),
+              TypeSupport.of(LexicalUUIDType.instance, 
Generators.UUID_RANDOM_GEN.mix(Generators.UUID_TIME_GEN)),
+              TypeSupport.of(InetAddressType.instance, 
Generators.INET_ADDRESS_UNRESOLVED_GEN, (a, b) -> 
FastByteOperations.compareUnsigned(a.getAddress(), b.getAddress())), // 
serialization strips the hostname, only keeps the address
+              /*
+              TODO
+              if (type instanceof StringType)
+        {
+            StringType st = (StringType) type;
+            return (Comparator<Object>) (Comparator<?>) (String a, String b) 
-> FastByteOperations.compareUnsigned(st.decompose(a), st.decompose(b));
+        }
+               */
+              TypeSupport.of(AsciiType.instance, 
SourceDSL.strings().ascii().ofLengthBetween(0, 1024)),
+              TypeSupport.of(UTF8Type.instance, Generators.utf8(0, 1024)),
               TypeSupport.of(TimestampType.instance, Generators.DATE_GEN),
+              TypeSupport.of(SimpleDateType.instance, 
SourceDSL.integers().between(0, Integer.MAX_VALUE)), // can't use time gen as 
this is an int, and in Milliseconds... so overflows...
               // null is desired here as #decompose will call 
org.apache.cassandra.serializers.EmptySerializer.serialize which ignores the 
input and returns empty bytes
-              TypeSupport.of(EmptyType.instance, rnd -> null)
-              //TODO add the following
-              // IntegerType.instance,
-              // DecimalType.instance,
-              // TimeUUIDType.instance,
-              // LexicalUUIDType.instance,
-              // SimpleDateType.instance,
-              // TimeType.instance,
-              // DurationType.instance,
+              TypeSupport.of(EmptyType.instance, rnd -> null, (a, b) -> 0),
+              TypeSupport.of(DurationType.instance, 
CassandraGenerators.duration(), Comparator.comparingInt(Duration::getMonths)

Review Comment:
   this is *not* how `DurationType` sorts... but that's also why every place 
that cares about ordering has to block it... its ordering is effectually 
random... 
   
   `TypeSupport` is focused on what we *should* do and not what we did...



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to