kalayciburak opened a new pull request, #13681:
URL: https://github.com/apache/gravitino/pull/13681
### What changes were proposed in this pull request?
`CommonUtil.normalizeToken` now maps the underscore-free `ExistOk` spelling
to `EXIST_OK` after trim and upper-case. Snake_case `exist_ok` is unchanged.
Single-word tokens are not split on internal capitals, so `OverWrite` stays
`OVERWRITE`.
### Why are the changes needed?
The Lance namespace spec says `mode` is case insensitive and accepts both
PascalCase and snake_case (`Create`, `ExistOk`, `Overwrite`). `normalizeToken`
only trimmed and upper-cased, so `ExistOk` became `EXISTOK` and
`parseEnumToken` rejected it on CreateNamespace and CreateTable. `exist_ok`
already worked.
A general PascalCase split would turn `OverWrite` into `OVER_WRITE`.
Authorization compares the normalized token to `OVERWRITE`, so that split would
stop recognizing an overwrite.
Fixes #13680
### Does this PR introduce _any_ user-facing change?
Clients can send `ExistOk` (any case, with or without surrounding space,
including the underscore-free form) anywhere `exist_ok` is accepted. Other mode
and behavior tokens are unchanged. No API or configuration keys are added or
removed.
### How was this patch tested?
RED on current main: `normalizeToken("ExistOk")` returned `EXISTOK`, and
`createTable(..., "ExistOk", ...)` threw `Unknown create table mode: ExistOk`.
GREEN:
```
JAVA_HOME=17 ./gradlew :lance:lance-rest-server:test --tests
org.apache.gravitino.lance.common.ops.gravitino.TestGravitinoLanceModeParsing
--tests
org.apache.gravitino.lance.service.authorization.TestLanceMetadataAuthorizationMethodInterceptor
-PskipITs -PskipDockerTests
```
`TestGravitinoLanceModeParsing` 11 tests, 0 failures.
`TestLanceMetadataAuthorizationMethodInterceptor` 26 tests, 0 failures.
Spotless applied on `lance-common` and `lance-rest-server`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]