aratno commented on code in PR #3995: URL: https://github.com/apache/cassandra/pull/3995#discussion_r2007674972
########## test/unit/org/apache/cassandra/utils/Generators.java: ########## @@ -492,13 +494,20 @@ public static <T> Gen<Set<T>> set(Gen<T> gen, Gen<Integer> sizeGen) }; } - public static <T extends Comparable<? super T>> Gen<List<T>> uniqueList(Gen<T> gen, Gen<Integer> sizeGen) + public static <T> Gen<List<T>> uniqueList(Gen<T> gen, Gen<Integer> sizeGen) { - return set(gen, sizeGen).map(t -> { - List<T> list = new ArrayList<>(t); - list.sort(Comparator.naturalOrder()); - return list; - }); + return rnd -> { + int size = sizeGen.generate(rnd); + Set<T> set = Sets.newHashSetWithExpectedSize(size); + List<T> output = new ArrayList<>(size); + for (int i = 0; i < size; i++) + { + T value; + while (!set.add(value = gen.generate(rnd))) {} Review Comment: In the meantime, want to set an iteration limit with a specific error? Just to make it a bit easier to figure out what's happening if a test is timing out. ########## test/distributed/org/apache/cassandra/distributed/test/cql3/SingleNodeTableWalkTest.java: ########## @@ -78,6 +79,17 @@ public class SingleNodeTableWalkTest extends StatefulASTBase { + private static final Gen<Gen<Boolean>> BOOLEAN_DISTRIBUTION = Gens.bools().mixedDistribution(); + //TODO (coverage): COMPOSITE, DYNAMIC_COMPOSITE + private static Gen<Gen<TypeKind>> TYPE_KIND_DISTRIBUTION = Gens.mixedDistribution(TypeKind.PRIMITIVE, + TypeKind.SET, TypeKind.LIST, TypeKind.MAP, + TypeKind.TUPLE, TypeKind.UDT, + TypeKind.VECTOR + ); + private static Gen<Gen<AbstractType<?>>> PRIMITIVE_DISTRIBUTION = Gens.mixedDistribution(AbstractTypeGenerators.knownPrimitiveTypes() + .stream() + .filter(t -> !AbstractTypeGenerators.isUnsafeEquality(t)) + .collect(Collectors.toList())); Review Comment: Can be final ########## test/distributed/org/apache/cassandra/distributed/test/cql3/SingleNodeTableWalkTest.java: ########## @@ -424,7 +448,8 @@ public State(RandomSource rs, Cluster cluster) .withoutTransaction() .withoutTtl() .withoutTimestamp() - .withPartitions(SourceDSL.arbitrary().pick(uniquePartitions)); + .withPartitions(SourceDSL.arbitrary().pick(uniquePartitions)) + .withColumnExpressions(e -> e.withOperators(Generators.fromGen(BOOLEAN_DISTRIBUTION.next(rs)))); Review Comment: Required for CASSANDRA-20449 repro at least 😄 ########## test/harry/main/org/apache/cassandra/harry/model/BytesPartitionState.java: ########## @@ -135,7 +141,13 @@ private long[] toDescriptor(ImmutableUniqueList<Symbol> positions, Map<Symbol, B Symbol column = positions.get(i); if (values.containsKey(column)) { - long vd = factory.valueCache.deflate(new Value(column.type(), values.get(column))); + ByteBuffer value = values.get(column); + if (value == null || !value.hasRemaining() && (column.type().isUDT() && column.type().isMultiCell())) Review Comment: Can you add this as a comment inline? -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org