You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2026/04/15 06:42:55 UTC
(skywalking-banyandb) 02/04: chore(query): clarify OR nil-branch comment and add test-case generation CI check
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch test/query
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit 61645759fd119390be4293921ff80cf2aec02524
Author: Hongtao Gao <ha...@gmail.com>
AuthorDate: Wed Apr 15 04:52:01 2026 +0000
chore(query): clarify OR nil-branch comment and add test-case generation CI check
Improve the comment accuracy in BuildQuery's OR nil-branch handling to
precisely describe entity-level series lookup scoping. Add CI drift
detection for generated measure test cases and a Makefile target for
local regeneration.
via [HAPI](https://hapi.run)
Co-Authored-By: HAPI <no...@hapi.run>
---
.github/workflows/ci.yml | 7 +++++++
Makefile | 6 +++++-
pkg/index/inverted/query.go | 6 +++---
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6c63110c4..5024c7113 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -62,6 +62,13 @@ jobs:
git status -s; \
exit 1; \
fi
+ - name: Generate test cases and check drift
+ run: |
+ make generate-test-cases
+ git diff --exit-code -- test/cases/measure/data/input/ \
+ || (echo "::error::Generated test cases have drifted. Run 'make generate-test-cases' locally and commit the changes." \
+ && git diff --stat -- test/cases/measure/data/input/ \
+ && exit 1)
- name: Check License Header
run: make license-check
- name: Check requirements
diff --git a/Makefile b/Makefile
index 210087df9..922b24f95 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,9 @@ generate: TARGET=generate
generate: PROJECTS:=api $(PROJECTS) pkg
generate: default ## Generate API codes
+generate-test-cases: ## Regenerate measure query test cases (input/*.ql, input/*.yaml)
+ go run ./test/cases/measure/cmd/generate generate test/cases/measure/data
+
build: TARGET=all
build: default ## Build all projects
@@ -141,6 +144,7 @@ check: ## Check that the status is consistent with CI
pre-push: ## Check source files before pushing to the remote repo
$(MAKE) check-req
$(MAKE) generate
+ $(MAKE) generate-test-cases
$(MAKE) lint
$(MAKE) check
$(MAKE) vuln-check
@@ -222,7 +226,7 @@ release-push-candidate: ## Push release candidate
${PUSH_RELEASE_SCRIPTS}
.PHONY: all $(PROJECTS) clean build default nuke
-.PHONY: lint check tidy format pre-push
+.PHONY: lint check tidy format pre-push generate-test-cases
.PHONY: test test-race test-coverage test-ci test-docker
.PHONY: license-check license-fix license-dep
.PHONY: release release-binary release-source release-sign release-assembly
diff --git a/pkg/index/inverted/query.go b/pkg/index/inverted/query.go
index add0f2f4c..1221e4643 100644
--- a/pkg/index/inverted/query.go
+++ b/pkg/index/inverted/query.go
@@ -147,9 +147,9 @@ func BuildQuery(criteria *modelv1.Criteria, schema logical.Schema, entityDict ma
node: newMatchAllNode(),
}, entities, true, nil
}
- // When one OR branch has no query (entity-only), check if all entities are specific.
- // If no AnyTagValue is present, the nil branch's entity needs match-all to find its documents.
- // When AnyTagValue exists, the other branch's query already covers all entities.
+ // When one OR branch is entity-only (nil query), entity-level series lookup already
+ // constrains the scope. If all entities are specific (no AnyTagValue wildcards),
+ // return match-all — no index query is needed.
if left == nil || right == nil {
allSpecific := true
for _, entity := range entities {