Skip to content

Conversation

@lucasfang
Copy link
Collaborator

support map<string, string> to/from json string and string util replace last

Purpose

Linked issue: close #xxx

Tests

API and Format

Documentation

Copilot AI review requested due to automatic review settings January 5, 2026 03:57
Copy link

Copilot AI left a 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() and RapidJsonUtil::MapFromJsonString() for map<string, string> JSON serialization
  • Enhanced RapidJsonUtil::ToJsonString() and FromJsonString() 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.

@lucasfang lucasfang requested a review from lxy-9602 January 5, 2026 06:22
Copy link
Collaborator

@lxy-9602 lxy-9602 left a comment

Choose a reason for hiding this comment

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

+1

@lucasfang lucasfang merged commit 39fea58 into alibaba:main Jan 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants