Skip to content
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

Fix Distributed Query Bug #501

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Release Notes.
- Fix the wrong array flags parsing in command line. The array flags should be parsed by "StringSlice" instead of "StringArray".
- Fix a bug that the Stream module didn't support duplicated in index-based filtering and sorting
- Fix the bug that segment's reference count is increased twice when the controller try to create an existing segment.
- Fix a bug where a distributed query would return an empty result if the "limit" was set much lower than the "offset".

### Documentation
- Introduce new doc menu structure.
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/logical/measure/measure_plan_distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (ud *unresolvedDistributed) Analyze(s logical.Schema) (logical.Plan, error)
Name: ud.originalQuery.Name,
Groups: ud.originalQuery.Groups,
Criteria: ud.originalQuery.Criteria,
Limit: limit,
Limit: limit + ud.originalQuery.Offset,
OrderBy: ud.originalQuery.OrderBy,
}
if ud.groupByEntity {
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/logical/stream/stream_plan_distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (ud *unresolvedDistributed) Analyze(s logical.Schema) (logical.Plan, error)
Name: ud.originalQuery.Name,
Groups: ud.originalQuery.Groups,
Criteria: ud.originalQuery.Criteria,
Limit: limit,
Limit: limit + ud.originalQuery.Offset,
OrderBy: ud.originalQuery.OrderBy,
}
if ud.originalQuery.OrderBy == nil {
Expand Down
2 changes: 1 addition & 1 deletion test/cases/measure/data/input/limit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ tagProjection:
tags: ["entity_id"]
fieldProjection:
names: ["total", "value"]
limit: 2
limit: 1
offset: 3
17 changes: 0 additions & 17 deletions test/cases/measure/data/want/limit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,3 @@ dataPoints:
str:
value: entity_4
timestamp: "2023-06-26T01:01:00Z"
- fields:
- name: total
value:
int:
value: "50"
- name: value
value:
int:
value: "4"
tagFamilies:
- name: default
tags:
- key: entity_id
value:
str:
value: entity_5
timestamp: "2023-06-26T01:02:00Z"
1 change: 1 addition & 0 deletions test/cases/stream/data/input/offset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ projection:
- name: "data"
tags: ["data_binary"]
offset: 3
limit: 1
40 changes: 14 additions & 26 deletions test/cases/stream/data/want/offset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,17 @@
# under the License.

elements:
- elementId: "3"
tagFamilies:
- name: searchable
tags:
- key: trace_id
value:
str:
value: "4"
- name: data
tags:
- key: data_binary
value:
binaryData: YWJjMTIzIT8kKiYoKSctPUB+
- elementId: "4"
tagFamilies:
- name: searchable
tags:
- key: trace_id
value:
str:
value: "5"
- name: data
tags:
- key: data_binary
value:
binaryData: YWJjMTIzIT8kKiYoKSctPUB+
- elementId: "3"
tagFamilies:
- name: searchable
tags:
- key: trace_id
value:
str:
value: "4"
- name: data
tags:
- key: data_binary
value:
binaryData: YWJjMTIzIT8kKiYoKSctPUB+

Loading