[
https://issues.apache.org/jira/browse/CASSANDRA-19040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andres de la Peña updated CASSANDRA-19040:
------------------------------------------
Test and Documentation Plan:
||PR||CI||
|[5.0
|https://github.com/apache/cassandra/pull/2922]|[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/3323/workflows/77a3e6bb-02f2-4dff-a122-e51137715b2d]
[j17|https://app.circleci.com/pipelines/github/adelapena/cassandra/3323/workflows/9556917a-7b47-4d1e-900f-65cb2c8d857b]|
|[trunk|https://github.com/apache/cassandra/pull/2925]|[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/3324/workflows/a087d8c8-1eb8-43fb-be7e-cf5c6bd09b85]
[j17|https://app.circleci.com/pipelines/github/adelapena/cassandra/3324/workflows/83d5ea7f-1134-4122-a80d-ecd1f4dd1a6f]|
was:
||PR||CI||
|[5.0
|https://github.com/apache/cassandra/pull/2922]|[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/3321/workflows/1450ed03-61d9-4abc-93f0-ad0a335dd703]
[j17|https://app.circleci.com/pipelines/github/adelapena/cassandra/3322/workflows/e1c75b36-f6eb-440a-8627-e6b433ad10bd]|
> Consider CONTAINS KEY in SAI unindexed index contexts
> -----------------------------------------------------
>
> Key: CASSANDRA-19040
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19040
> Project: Cassandra
> Issue Type: Bug
> Components: Feature/SAI
> Reporter: Andres de la Peña
> Assignee: Andres de la Peña
> Priority: Normal
> Fix For: 5.0-beta
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> As reported by CASSANDRA-19034,
> {{SelectTest#testContainsKeyAndContainsWithIndexOnMapValue}} fails when the
> default config uses SAI:
> {code:java}
> [junit-timeout] Testcase:
> testContainsKeyAndContainsWithIndexOnMapValue(org.apache.cassandra.cql3.validation.operations.SelectTest)-_jdk11:
> FAILED
> [junit-timeout] Got less rows than expected. Expected 1 but got 0
> [junit-timeout] junit.framework.AssertionFailedError: Got less rows than
> expected. Expected 1 but got 0
> [junit-timeout] at
> org.apache.cassandra.cql3.CQLTester.assertRows(CQLTester.java:1849)
> [junit-timeout] at
> org.apache.cassandra.cql3.validation.operations.SelectTest.lambda$testContainsKeyAndContainsWithIndexOnMapValue$9(SelectTest.java:625)
> [junit-timeout] at
> org.apache.cassandra.cql3.CQLTester.beforeAndAfterFlush(CQLTester.java:2238)
> [junit-timeout] at
> org.apache.cassandra.cql3.validation.operations.SelectTest.testContainsKeyAndContainsWithIndexOnMapValue(SelectTest.java:618)
> [junit-timeout] at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit-timeout] at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [junit-timeout] at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [junit-timeout]
> [junit-timeout]
> {code}
> This can also be reproduced with this simple test:
> {code:java}
> createTable("CREATE TABLE %s (k int PRIMARY KEY, v int, m map<int,int>)");
> createIndex("CREATE INDEX ON %s(v) USING 'SAI'");
> execute("INSERT INTO %s (k, v, m) VALUES (?, ?, ?)", 0, 1, map(2, 3));
> assertRows(execute("SELECT k, v, m FROM %s WHERE v = 1 AND m CONTAINS KEY 2
> ALLOW FILTERING"),
> row(0, 1, map(2, 3)));
> {code}
> I think the problem is that the index context created by the query planner
> for an unindexed column always has a {{VALUES}} index target type,
> [here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/index/sai/plan/QueryController.java#L149].
> This is problematic when there is a {{CONTAINS KEY}} expression that isn't
> backed by an index, since we'll be comparing the searched map key to scanned
> map values.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]