Skip to content

fix: querier null filter error#11466

Open
xiaochaoren1 wants to merge 2 commits intomainfrom
querier-null-filter
Open

fix: querier null filter error#11466
xiaochaoren1 wants to merge 2 commits intomainfrom
querier-null-filter

Conversation

@xiaochaoren1
Copy link
Contributor

This PR is for:

@xiaochaoren1
Copy link
Contributor Author

@claude 审核代码,中文回答

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @xiaochaoren1's task in 40m 7s —— View job


任务清单

  • 阅读 CLAUDE.md 了解仓库规范(未发现)
  • 查看 PR 变更并理解代码上下文
  • 输出代码审查反馈(中文)

审查结论

本次改动在 parseWhere 中新增 IS NULL/IS NOT NULL 支持,整体思路清晰。但当前实现对复合过滤与资源类标签的“存在性”语义可能产生偏差,建议在合入前处理以下问题。

需要关注的问题

  1. server/querier/engine/clickhouse/clickhouse.go:2029-2033
    仅替换首个 “= NULL”。当 filterExpr 由多个子条件组成(例如 k8s.label/tag.* 会生成多个子查询)时,后续的 “= NULL” 仍保留,ClickHouse 会把它当作 NULL 比较导致条件恒为 NULL。建议改为替换所有出现的 “= NULL”。
    Fix this →

  2. server/querier/engine/clickhouse/clickhouse.go:2015-2036
    对资源类 tag(例如 vpc/l2_vpc 等)目前通过 WhereTranslator 生成 “name = NULL” 的子查询,这与现有 NotNullFilter/存在性语义不一致,容易导致 IS NULL 返回空或 IS NOT NULL 结果错误。建议优先使用 GetNotNullFilter(存在时)并对 IS NULL 取反,对 IS NOT NULL 直接使用。
    Fix this →

测试

  • 未运行(未提供测试指令)

@xiaochaoren1
Copy link
Contributor Author

@claude 审核代码,中文回答

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @xiaochaoren1's task in 34m 27s —— View job


I'll analyze this and get back to you.

lzf575
lzf575 previously approved these changes Mar 13, 2026
@xiaochaoren1
Copy link
Contributor Author

@claude 修复需要关注的问题 1

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @xiaochaoren1's task in 5m 17s —— View job


任务清单

  • 确认仓库 CLAUDE.md 指引
  • 修复 IS NULL 处理中仅替换首个 = NULL 的问题
  • 提交并推送修改
  • 更新 PR 评论汇报结果

修改说明

已将 IS NULL 处理中的替换逻辑改为 strings.ReplaceAll,确保复合过滤条件里的每个 = NULL 都会被转换为 IS NULL。对应代码位置:server/querier/engine/clickhouse/clickhouse.go:2029-2032

测试

未运行(未提供测试指令)。

@xiaochaoren1
Copy link
Contributor Author

@claude 修复需要关注的问题 2

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @xiaochaoren1's task in 11m 37s —— View job


任务清单

  • 阅读 CLAUDE.md(若有)并确认仓库规范(未发现)
  • 使用 NotNullFilter 修正资源类 tag 的 IS NULL/IS NOT NULL 逻辑
  • 同步远端分支更新(需要执行 git pull --rebase,当前未获授权)
  • 推送变更到 PR 分支
  • 更新审查结论

进度说明

推送时发现远端分支有新提交,需要先 git pull --rebase origin querier-null-filter 同步后再推送。当前该命令未获授权,请允许后我继续。

Co-authored-by: LIU Chao <xiaochaoren1@users.noreply.github.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ xiaochaoren1
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

3 participants