You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "ButterBright (via GitHub)" <gi...@apache.org> on 2025/12/18 15:52:38 UTC
[PR] Validate the query during plan construction [skywalking-banyandb]
ButterBright opened a new pull request, #904:
URL: https://github.com/apache/skywalking-banyandb/pull/904
<!--
β οΈ Please make sure to read this template first, pull requests that don't accord with this template
maybe closed without notice.
Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
-->
<!-- ==== π Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist π ====
### Fix <bug description or the bug issue number or bug issue link>
- [ ] Add a unit test to verify that the fix works.
- [ ] Explain briefly why the bug exists and how to fix it.
==== π Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist π ==== -->
<!-- ==== π Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist π ====
### <Feature description>
- [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
- [ ] Update the documentation to include this new feature.
- [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
- [ ] If it's UI related, attach the screenshots below.
==== π Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist π ==== -->
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Fixes apache/skywalking#<issue number>.
- [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Validate the query during plan construction [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #904:
URL: https://github.com/apache/skywalking-banyandb/pull/904#discussion_r2636790095
##########
api/proto/banyandb/model/v1/write.proto:
##########
@@ -34,4 +34,5 @@ enum Status {
STATUS_VERSION_UNSUPPORTED = 7; // Client version not supported
STATUS_VERSION_DEPRECATED = 8; // Client version deprecated but still supported
STATUS_METADATA_REQUIRED = 9; // Metadata is required for the first request
+ STATUS_INVALID_QUERY = 10; // Query validation failed
Review Comment:
The status indicates whether writing or data syncing is in progress. It appears that the status related to queries is not included here.
These codes typically notify the client to take different actions. However, for queries, the client only reports the error to the user without any further actions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Validate the query during plan construction [skywalking-banyandb]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #904:
URL: https://github.com/apache/skywalking-banyandb/pull/904#discussion_r2631647535
##########
pkg/query/logical/criteria_tags.go:
##########
@@ -40,3 +44,31 @@ func CollectCriteriaTagNames(criteria *modelv1.Criteria, tags map[string]struct{
CollectCriteriaTagNames(exp.Le.Right, tags)
}
}
+
+// ValidateCriteriaTags validates that all tags referenced in the criteria exist in the schema.
+func ValidateCriteriaTags(criteria *modelv1.Criteria, registry TagSpecRegistry) error {
+ if criteria == nil {
+ return nil
+ }
+ switch exp := criteria.GetExp().(type) {
+ case *modelv1.Criteria_Condition:
+ cond := criteria.GetCondition()
+ if cond == nil {
+ return nil
+ }
+ if registry.FindTagSpecByName(cond.Name) == nil {
+ return errors.WithMessagef(ErrTagNotDefined, "condition tag %q does not exist in schema", cond.Name)
+ }
+ case *modelv1.Criteria_Le:
+ if exp.Le == nil {
+ return nil
+ }
+ if err := ValidateCriteriaTags(exp.Le.Left, registry); err != nil {
+ return err
+ }
+ if err := ValidateCriteriaTags(exp.Le.Right, registry); err != nil {
+ return err
+ }
+ }
+ return nil
+}
Review Comment:
The new ValidateCriteriaTags function is a useful addition for centralizing validation logic. However, there appears to be no test coverage for this new function. Consider adding unit tests to verify:
1. Validation passes for valid criteria with existing tags
2. Validation fails with appropriate error messages for non-existent tags in conditions
3. Validation correctly handles logical expressions (Le) with nested criteria
4. Validation handles nil/empty criteria gracefully
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve groupBy, orderBy and multi-group queries [skywalking-banyandb]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng merged PR #904:
URL: https://github.com/apache/skywalking-banyandb/pull/904
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Validate the query during plan construction [skywalking-banyandb]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #904:
URL: https://github.com/apache/skywalking-banyandb/pull/904#issuecomment-3671016322
## [Codecov](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/904?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.65%. Comparing base ([`3530dd9`](https://app.codecov.io/gh/apache/skywalking-banyandb/commit/3530dd9b5cefaa4fef60eec91ecbfbdfcaf243c5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`cb927d3`](https://app.codecov.io/gh/apache/skywalking-banyandb/commit/cb927d3a3494777c1807eaed298b972b3c100952?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 76 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #904 +/- ##
===========================================
+ Coverage 45.97% 90.65% +44.67%
===========================================
Files 328 7 -321
Lines 55505 642 -54863
===========================================
- Hits 25520 582 -24938
+ Misses 27909 39 -27870
+ Partials 2076 21 -2055
```
| [Flag](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/904/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ | |
|---|---|---|
| [fodc](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/904/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.65% <ΓΈ> (?)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/904?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org