Closed vkarpov15 closed 1 month ago
It looks like this issue isn't limited to just _id, but also means you can't query by properties with uppercase letters. For example, consider the following setup:
CREATE TABLE people (
id text,
"firstName" text,
PRIMARY KEY (id));
CREATE INDEX ON people ("firstName");
INSERT INTO PEOPLE (id, "firstName") VALUES ('000000000000000000000000', 'John');
Making request that filters by firstName
fails:
$ curl -H 'Content-Type: application/json' -H 'X-Cassandra-Token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' -X POST -d '{"findOne":{"filter":{"firstName":"John"},"options":{}}}' http://127.0.0.1:8181/v1/demo/people
{"errors":[{"message":"Server failed: root cause: (java.lang.RuntimeException) io.stargate.sgv2.jsonapi.service.operation.filters.table.codecs.UnknownColumnException: No column found for table people with name firstname","errorCode":"SERVER_UNHANDLED_ERROR"},{"message":"Server failed: root cause: (io.stargate.sgv2.jsonapi.service.operation.filters.table.codecs.UnknownColumnException) No column found for table people with name firstname","errorCode":"SERVER_UNHANDLED_ERROR"}]}
Works fine if you replace firstName
with first_name
.
It is possible there are 2 different problems (special handling for _id
due to Collection requiring different kind of filter construction, vs. quoting for non-lower-case column names) or just 1 (quoting). But I can create failing tests for quoting and see if solving that might solve _id
case too.
@vkarpov15 I noticed that you didn't include specific curl
command you used -- would it be possible to add that, just so I know I am reproducing exact issue (like find
vs findOne
)
It definitely appears that:
_id
or ID
works fine (after fixes in PR)_id
or ID
also works fine (ditto)findOne()
/find()
fails with both_id
and ID
(or similar), based on error messageI may need to create a different issue.
Changed description here to match the general problem with unquoted column names being used; to be fixed by #1355
This issue, PR that fixes (#1355) is for general problem: filed #1357 for follow-up work wrt _id
.
@vkarpov15 Fixed almost all issues, but _id
itself still problematic for findOne
/find
for some reason. So #1357 is for solving that. But at least Id
and ID
etc should now work.
I created a keyspace in cqlsh:
Create table with
_id
as the primary key:Insert a new row into the table:
Send a curl command to filter by
_id
and you get aFilter type not supported
error:This only seems to happen with _id, replace _id with id and this works fine.