zhangshenghang commented on issue #10348:
URL: https://github.com/apache/seatunnel/issues/10348#issuecomment-3756827232
<!-- code-pr-reviewer -->
Thanks for reporting this. Based on the code analysis, this issue likely
exists.
The `normalizePlaceholders()` method in `RedisSinkWriter.java` (L269-281)
uses regex `(?<!\\$)\\{([^}]+)\\}` which incorrectly consumes nested braces
like `{{user_id}}`, converting them to `${user_id}` instead of preserving the
outer literal braces for Redis cluster HashTag patterns (e.g.,
`u:{{user_id}}:member` should become `u:{12345}:member`).
The current regex only supports single-layer placeholders `{fieldName}` →
`${fieldName}`, which is verified by existing tests in
`RedisSinkWriterTest.java` (L70-113) that only cover `user:${id}:profile` and
`user:{id}:profile` formats, missing nested brace scenarios.
Two clarifications before proceeding with a fix:
1. Should the outer literal braces be preserved when users intentionally mix
legacy format within HashTag braces (e.g., `{{id}}` → `{${id}}`), or should we
require `${}` syntax exclusively?
2. Should we add a configuration option to disable legacy format
normalization entirely for cluster mode users?
A good starting point would be updating `LEGACY_PLACEHOLDER_PATTERN` at
L56-57 to avoid matching nested braces, or adding a config flag to skip
normalization in the `getCustomKey()` method at L116.
--
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]