Skip to content

Core, Open-API: Use String.replace for literal replacements - #17484

Open
uros-b wants to merge 2 commits into
apache:mainfrom
uros-b:core-expressionparser-use-string-replace
Open

Core, Open-API: Use String.replace for literal replacements#17484
uros-b wants to merge 2 commits into
apache:mainfrom
uros-b:core-expressionparser-use-string-replace

Conversation

@uros-b

@uros-b uros-b commented Aug 2, 2026

Copy link
Copy Markdown
Member

Several places used String.replaceAll with literal (non-regex) patterns, which compiles a regex Pattern on every call. Switch these to the char/CharSequence String.replace overloads, which avoid the per-call compilation. Behavior-identical.

operationType and fromType replaced single literal characters using String.replaceAll, which compiles a regex Pattern on every call. The patterns contain no regex metacharacters, so this switches to the char-based String.replace, avoiding the per-call compilation. Behavior-identical.
@github-actions github-actions Bot added the core label Aug 2, 2026

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for CI, cc @szehon-ho for review

@ebyhr ebyhr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm other replaceAll usages? e.g. ReportMetricsRequestParser, RCKUtils

@uros-b

uros-b commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Good catch, thank you @ebyhr!

@uros-b uros-b changed the title Core: Use String.replace for literal replacements in ExpressionParser Core, Open-API: Use String.replace for literal replacements Aug 3, 2026
@uros-b
uros-b requested a review from ebyhr August 3, 2026 09:22
@ebyhr

ebyhr commented Aug 4, 2026

Copy link
Copy Markdown
Member

We can update more:

TableIdentifier.of("default", QUOTED_SPECIAL_CHARS_TABLE_NAME.replaceAll("`", ""));

TableIdentifier.of("default", QUOTED_SPECIAL_CHARS_TABLE_NAME.replaceAll("`", ""));

TableIdentifier.of("default", QUOTED_SPECIAL_CHARS_TABLE_NAME.replaceAll("`", ""));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants