Merge branch 'cassandra-5.0' into trunk

This commit is contained in:
David Capwell 2025-04-16 15:21:55 -07:00
commit e1823e0e22
3 changed files with 47 additions and 1 deletions

View File

@ -176,6 +176,7 @@
* Add the ability to disable bulk loading of SSTables (CASSANDRA-18781)
* Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787)
Merged from 5.0:
* SAI fails queries when multiple columns exist and a non-indexed column is a composite with a map (CASSANDRA-19891)
* Avoid purging deletions in RowFilter when reconciliation is required (CASSANDRA-20541)
* Fixed multiple single-node SAI query bugs relating to static columns (CASSANDRA-20338)
* Upgrade com.datastax.cassandra:cassandra-driver-core:3.11.5 to org.apache.cassandra:cassandra-driver-core:3.12.1 (CASSANDRA-17231)

View File

@ -144,7 +144,8 @@ public class IndexTermType
AbstractType<?> baseType = indexType.unwrap();
if (baseType.subTypes().isEmpty())
// We only need to inspect subtypes when it is possible for them to be queried individually.
if (baseType.subTypes().isEmpty() || indexTargetType == IndexTarget.Type.SIMPLE || indexTargetType == IndexTarget.Type.FULL)
{
this.subTypes = Collections.emptyList();
}

View File

@ -65,4 +65,48 @@ public class ComplexQueryTest extends SAITester
var result = execute("SELECT pk FROM %s WHERE str_val = 'A' AND val = 'A'");
assertRows(result, row(3));
}
@Test
public void compositeTypeWithMapInsideQuery()
{
createTable(KEYSPACE, "CREATE TABLE %s (" +
"pk1 frozen<map<'CompositeType(IntegerType,SimpleDateType)', 'DynamicCompositeType(Q=>LongType,I=>ByteType,6=>LexicalUUIDType)'>>," +
"pk2 frozen<tuple<frozen<tuple<float>>>>," +
"ck1 frozen<list<frozen<map<'LexicalUUIDType', ascii>>>>," +
"ck2 tinyint," +
"r1 frozen<list<'DynamicCompositeType(X=>DecimalType,y=>TimestampType,f=>BooleanType)'>> static," +
"r2 'DynamicCompositeType(P=>ShortType)'," +
"r3 'CompositeType(FrozenType(ListType(DoubleType)),FrozenType(MapType(LongType,DoubleType)),DoubleType)'," +
"r4 frozen<list<frozen<list<time>>>>," +
"r5 'CompositeType(CompositeType(ShortType,SimpleDateType,BooleanType),CompositeType(FloatType),MapType(ByteType,TimeType))'," +
"r6 set<smallint>," +
"PRIMARY KEY ((pk1, pk2), ck1, ck2))");
createIndex("CREATE INDEX ON %s (FULL(ck1)) USING 'SAI'");
createIndex("CREATE INDEX ON %s (FULL(pk1)) USING 'SAI'");
createIndex("CREATE INDEX ON %s (FULL(r4)) USING 'SAI'");
createIndex("CREATE INDEX ON %s (r2) USING 'SAI'");
createIndex("CREATE INDEX ON %s (r3) USING 'SAI'");
UntypedResultSet withMultipleColumns = execute("SELECT pk1 FROM " +
"%s " +
"WHERE r5 = 0x0010000230bd00000457f0bd31000001000000000700049f647252000000260000000200000001f300000008000001c4e14bba4b00000001260000000800003f2b300d385d00" +
" AND r3 = 0x001c00000002000000083380d171eace676900000008e153bb97fdd5c22e00006d000000030000000897c5493857999fc000000013f08cc4fad0f04d0de51cff28d4ae743d2da1c40000000857108e8c372c868400000013f0cc6bca55f0ee240b27ff12c77a7b7dc3c665000000086c07d25fcdd3403500000013f0745922bdf0ac44c9b5ffd80f025ded9a211d000008200547f5da7a43aa00" +
" AND r2 = 0x8050000255e200 " +
" AND pk2 = ((-1.2651989E-23))" +
" ALLOW FILTERING;");
assertRowCount(withMultipleColumns, 0);
UntypedResultSet withoutSAI = execute("SELECT pk1 FROM " +
"%s " +
" WHERE r5 = 0x001c00000002000000083380d171eace676900000008e153bb97fdd5c22e00006d000000030000000897c5493857999fc000000013f08cc4fad0f04d0de51cff28d4ae743d2da1c40000000857108e8c372c868400000013f0cc6bca55f0ee240b27ff12c77a7b7dc3c665000000086c07d25fcdd3403500000013f0745922bdf0ac44c9b5ffd80f025ded9a211d000008200547f5da7a43aa00" +
" ALLOW FILTERING;");
assertRowCount(withoutSAI, 0);
}
}