feat: support map<string, string> to/from json string and string util#45
Merged
lucasfang merged 5 commits intoalibaba:mainfrom Jan 5, 2026
Merged
feat: support map<string, string> to/from json string and string util#45lucasfang merged 5 commits intoalibaba:mainfrom
lucasfang merged 5 commits intoalibaba:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds support for serializing and deserializing map<string, string> to/from JSON strings, and introduces a new ReplaceLast utility function to the StringUtils class. The changes enable direct JSON conversion for string-to-string maps without requiring custom ToJson/FromJson implementations.
Key changes:
- Added
StringUtils::ReplaceLast()method to replace the last occurrence of a substring - Implemented
RapidJsonUtil::MapToJsonString()andRapidJsonUtil::MapFromJsonString()for map<string, string> JSON serialization - Enhanced
RapidJsonUtil::ToJsonString()andFromJsonString()template methods with specialization for map<string, string>
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/paimon/common/utils/string_utils.h | Added declaration for ReplaceLast method |
| src/paimon/common/utils/string_utils.cpp | Implemented ReplaceLast functionality using rfind and replace |
| src/paimon/common/utils/string_utils_test.cpp | Added comprehensive test cases for ReplaceLast method |
| src/paimon/common/utils/rapidjson_util.h | Added template specialization for map<string, string> in ToJsonString/FromJsonString and declared helper methods |
| src/paimon/common/utils/rapidjson_util.cpp | New file implementing MapToJsonString and MapFromJsonString helper methods |
| src/paimon/common/utils/rapidjson_util_test.cpp | Added test case for map to/from JSON string conversion |
| src/paimon/CMakeLists.txt | Added rapidjson_util.cpp to the build sources list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lxy-9602
reviewed
Jan 5, 2026
lxy-9602
reviewed
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
support map<string, string> to/from json string and string util replace last
Purpose
Linked issue: close #xxx
Tests
API and Format
Documentation