Fix #2462: counter column apiSupport reports filter:false#2513
Conversation
A table with a counter column was described with apiSupport.filter:true, but filtering on a counter column is not actually supported and fails at runtime with INVALID_FILTER_COLUMN_VALUES (no CQL codec can bind a counter value for a filter). Flip the COUNTER type's apiSupport filter flag to false so the describe output (listTables/listTypes/createTable) matches actual support. This is purely a describe-output change: counter is already classified as unsupported-DML (insert=false), so no runtime gating or classification is affected. Also add a regression integration test asserting the describe output for a counter column reports filter:false, and correct the stale doc comment.
➡️ Unit Test Coverage Delta vs Main Branch
|
Unit Test Coverage Report
|
📉 Integration Test Coverage Delta vs Main Branch (dse69-it)
|
Integration Test Coverage Report (dse69-it)
|
📈 Integration Test Coverage Delta vs Main Branch (hcd-it)
|
Integration Test Coverage Report (hcd-it)
|
There was a problem hiding this comment.
-1 Blocking this merging.
There are two possible fixes here: either the API support flag is wrong (we dont support it) OR we actually should support it and the bug is that we dont.
we need to decide on what we want to do before letting AI write code. Also, PR comments such as these are not very helpful it is just a mash of words
| .templated() | ||
| .listTables(true) | ||
| .wasSuccessful() | ||
| .body(apiSupportPath + ".createTable", is(false)) |
There was a problem hiding this comment.
this is fragile and encourages copy-past coding, we would create assertion functions for this
|
There is an existing test the confirms some code things we should not be able to filter on a counter BUT checking the design docs we said it was possible to filter on a counter. we need to work out what is the correct behaviour |
|
Good point @amorton, digging into this in more detail (i.e., whether there's a technical reason why we don't support it, and if so, can we overcome that and support it, as the spec indicates that we want to do) |
Summary
Fixes #2462.
A table with a
countercolumn was described by the Data API withapiSupport.filter: true:…yet filtering on that column actually fails with
INVALID_FILTER_COLUMN_VALUES(there is no CQL codec that can bind a counter value into a filter). The advertised support contradicted the real behavior.Root cause
ApiDataTypeDefs.COUNTERdeclared its support asSupport(createTable=false, insert=false, read=true, filter=true, Update.NONE). Thefilter=trueflag is the only source of truth for theapiSupport.filtervalue surfaced inlistTables/listTypes/createTabledescribe output, so the describe output advertised a capability the runtime rejects.Fix
Flip the
COUNTERapiSupportfilter flag tofalseso the describe output matches actual support.This is purely a describe-output change — verified that no runtime behavior changes:
isUnsupportedDML()(!insert() || !read() || !filter()) was alreadytruefor counter becauseinsert=false, so the column's unsupported-DML/isUnsupportedAny()classification andApiTableDefunsupported-columns membership are unchanged.apiSupportblock was already emitted (it is gated onisAnyUnsupported(), already true viacreateTable=false); only the innerfilterfield value flipstrue → false.ApiSupportDef.Matchernever gates filtering on this flag (there is nowithFiltersetter; all production matchers usefilter=null).read=true, filter=falseis already an established, valid combination (frozen collections use it).Tests
listTablesReportsCounterNotFilterabletoUnsupportedTypeTableIntegrationTest.Counterasserting the describe output for a counter column reportscreateTable=false, insert=false, read=true, filter=false.filterCounterIT already covers the runtime rejection (INVALID_FILTER_COLUMN_VALUES) and continues to pass — together they confirm describe and runtime now agree.Filter(True)→Filter(False)doc comment on theCountertest class.Test plan
./mvnw test-compilepasses (JDK 21), formatting compliantUnsupportedTypeTableIntegrationTest(Counter nested class) passes against DSE/HCD