-
Notifications
You must be signed in to change notification settings - Fork 20
feat: support map<string, string> to/from json string and string util #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
support map<string, string> to/from json string and string util replace last
Purpose
Linked issue: close #xxx
Tests
API and Format
Documentation