This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Optimize various aspects of filter.go#1287
Open
dofson wants to merge 1 commit intotigrisdata-archive:mainfrom
Open
Optimize various aspects of filter.go#1287dofson wants to merge 1 commit intotigrisdata-archive:mainfrom
dofson wants to merge 1 commit intotigrisdata-archive:mainfrom
Conversation
对filter函数进行的优化内容:
(1)中文注释:添加了详细的中文注释,解释接口、结构、方法和每个核心函数的功能。如在 Factorize 和 ParseSelector 中,明确说明了每一步的逻辑处理目的
(2)改进了错误信息:如在 ParseSelector 和 buildValueMatcher 中,如果字段未定义或类型不支持,会抛出更明确的错误信息,并显示具体问题字段。
(3)性能优化:使用 jsonparser.ObjectEach 遍历 JSON 对象直接处理,避免不必要的中间对象创建,提升性能。
减少重复逻辑:将 JSON 类型到 Tigris 类型的转换封装为 toTigrisType 和 jsonToTigrisType 函数
(4)逻辑优化:
合并冗余逻辑:在 ParseSelector 中,对 dataType 的处理使用了封装函数,简化了类型判断和匹配。
增强模块化:排序规则的构建 buildCollation 和值匹配器 buildValueMatcher 独立为函数,便于后续扩展。
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
本PR对filter进行了各方面的优化
中文注释:添加了详细的中文注释,解释接口、结构、方法和每个核心函数的功能。如在 Factorize 和 ParseSelector 中,明确说明了每一步的逻辑处理目的
改进了错误信息:如在 ParseSelector 和 buildValueMatcher 中,如果字段未定义或类型不支持,会抛出更明确的错误信息,并显示具体问题字段。
性能优化:
3.1 使用 jsonparser.ObjectEach 遍历 JSON 对象直接处理,避免不必要的中间对象创建,提升性能。
3.2 减少重复逻辑:将 JSON 类型到 Tigris 类型的转换封装为 toTigrisType 和 jsonToTigrisType 函数。
逻辑优化:
4.1 合并冗余逻辑:在 ParseSelector 中,对 dataType 的处理使用了封装函数,简化了类型判断和匹配。
4.2 增强模块化:排序规则的构建 buildCollation 和值匹配器 buildValueMatcher 独立为函数,便于后续扩展。