Skip to content

Cassandra 19891 5.0 #4098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: cassandra-5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ private IndexTermType(ColumnMetadata columnMetadata, List<ColumnMetadata> partit

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();
}
Expand Down
44 changes: 44 additions & 0 deletions test/unit/org/apache/cassandra/index/sai/cql/ComplexQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,48 @@ public void splitRowsWithBooleanLogic()
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);
}
}