spring-data icon indicating copy to clipboard operation
spring-data copied to clipboard

[DE-684] confuse about some code

Open Korov opened this issue 3 years ago • 5 comments

com.arangodb.springframework.repository.query.derived.DerivedQueryCreator#createCriteria

the code final boolean checkUnique = part.getProperty().toDotPath().split(".").length <= 1; should be final boolean checkUnique = part.getProperty().toDotPath().split("\\.").length <= 1;?

Korov avatar Jan 01 '23 14:01 Korov

@Korov If you are asking regrading the regex, then I think the second approach (final boolean checkUnique = part.getProperty().toDotPath().split("\\.").length <= 1;) is the correct one.

DevPJ9 avatar Jan 01 '23 14:01 DevPJ9

@DevPJ9 Can I create a PR to fix it?

Korov avatar Jan 01 '23 15:01 Korov

Yeah sure. I am not related to arongdb. So I am not sure about rest.

However, you can raise a PR and mention it to someone who has admin rights or reviewing right to this repo, so that they can merge your PR.

DevPJ9 avatar Jan 01 '23 15:01 DevPJ9

This looks like a bug to me. AFAICS, fixing the regex with \\. would only lead to further bugs, namely if checkUnique is false then checkUniqueLocation(Part) is never invoked and uniqueLocation is null. This would generate AQL problems, i.e. accessing location field with null[0], null[1], in case the point is represented as an array of coordinate components.

Note that the code paths for checkUnique=false are in fact not tested.

rashtao avatar Jan 20 '23 09:01 rashtao

Internal tracking: DE-684

rashtao avatar Jan 24 '24 14:01 rashtao