-
Notifications
You must be signed in to change notification settings - Fork 220
feat(s2-core)S2内核支持通过“路径”读取嵌套数据结构中的字段值('a.b.c' 或 'a.b[0].c'), 嵌套层级不限(兼容原有平铺字段)。 #3233
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
base: next
Are you sure you want to change the base?
Conversation
|
你好 @xincheng123,非常感谢你的贡献. Hello, @xincheng123, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes. |
Summary of ChangesHello @xincheng123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在增强 S2 内核的数据处理能力,使其能够灵活地处理任意层级的嵌套数据结构。通过引入基于路径的字段值读取机制,用户现在可以使用点分隔符或数组索引来指定数据字段,从而极大地提升了数据配置的灵活性和表达力。这一改进确保了 S2 能够适应更复杂的数据模型,同时保持了对现有平铺数据结构的兼容性和性能。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
这个 PR 很好地实现了通过路径字符串访问嵌套数据的功能,这是一个很棒的增强。代码结构清晰,通过引入 getByPath 和 hasByPath 辅助函数,将嵌套访问逻辑集中处理,并对平铺字段做了快速路径优化,考虑了性能。同时,修改也覆盖了排序、筛选、导出等多个场景,考虑得很周全,并且添加了相应的单元测试。
我发现了一个潜在的小问题,在 hasByPath 函数的实现中,快速路径和慢速路径的行为存在不一致,具体请看我的评论。修复后,这个功能就更完美了。
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
🎨 Enhance
📝 嵌套字段支持(Nested Fields)
对S2 内核进行改造, 支持通过“路径”读取嵌套数据结构中的字段值, 嵌套层级不限(兼容原有平铺字段)。
示例数据:
注意事项:
user.region、metrics.city.address、metrics.city.address[0].name)。.或下标)仍走快速访问路径,性能无损。🔗 Related issue link
ref #3231
🔍 Self-Check before the merge