You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "StLeoX (via GitHub)" <gi...@apache.org> on 2024/08/25 13:55:49 UTC
[PR] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
StLeoX opened a new pull request, #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521
### Supports measure aggregate function (MAF)
- [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
- [ ] Update the documentation to include this new feature.
- [x] Tests(including UT, IT, E2E) are added to verify the new feature.
Currently `avg` and `min`.
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "StLeoX (via GitHub)" <gi...@apache.org>.
StLeoX commented on code in PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521#discussion_r1736248511
##########
banyand/measure/aggregate/avg_test.go:
##########
@@ -0,0 +1,39 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package aggregate
Review Comment:
fine
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "StLeoX (via GitHub)" <gi...@apache.org>.
StLeoX commented on code in PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521#discussion_r1735486228
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
Review Comment:
It works as a placeholder for type parameters of `Arguments`.
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521#discussion_r1735873268
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
Review Comment:
I need a use case to estimate the value of this type. If there is no case, we should remove it.
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521#discussion_r1735464067
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
Review Comment:
According to Go’s philosophy, if any type name should not include the package’s name.
```suggestion
type Input interface {
```
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
Review Comment:
What’s the Void used for? Would you show me some examples?
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ Void | ~string | ~int64 | ~float64 | ~[]string | ~[]int64
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
+ ~int64 | ~float64
+}
+
+var errFieldValueType = fmt.Errorf("unsupported input value type on this field")
+
+// MAFArguments represents the argument array, with at most three arguments.
+type MAFArguments[A, B, C MAFInput] struct {
Review Comment:
```suggestion
type Arguments[A, B, C MAFInput] struct {
```
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ Void | ~string | ~int64 | ~float64 | ~[]string | ~[]int64
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
Review Comment:
```suggestion
type Output interface {
```
##########
banyand/measure/aggregate/avg_test.go:
##########
@@ -0,0 +1,39 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package aggregate
Review Comment:
```suggestion
package aggregate_test
```
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ Void | ~string | ~int64 | ~float64 | ~[]string | ~[]int64
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
+ ~int64 | ~float64
+}
+
+var errFieldValueType = fmt.Errorf("unsupported input value type on this field")
+
+// MAFArguments represents the argument array, with at most three arguments.
+type MAFArguments[A, B, C MAFInput] struct {
+ arg0 []A
+ arg1 []B
+ arg2 []C
+}
+
+// MAF describes two stages of aggregation.
+type MAF[A, B, C MAFInput, K MAFKeep] interface {
Review Comment:
```suggestion
type Function[A, B, C MAFInput, K MAFKeep] interface {
```
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ Void | ~string | ~int64 | ~float64 | ~[]string | ~[]int64
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
+ ~int64 | ~float64
Review Comment:
Please make sure to include the string type since the input supports it.
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,92 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ Void | ~string | ~int64 | ~float64 | ~[]string | ~[]int64
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
+ ~int64 | ~float64
+}
+
+var errFieldValueType = fmt.Errorf("unsupported input value type on this field")
+
+// MAFArguments represents the argument array, with at most three arguments.
+type MAFArguments[A, B, C MAFInput] struct {
+ arg0 []A
+ arg1 []B
+ arg2 []C
Review Comment:
Is their type different? Do you have any examples?
##########
banyand/measure/aggregate/avg.go:
##########
Review Comment:
Add a “NewAvgArg” to create a argument for Avg’s Input
--
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] [ospp] Supports measure aggregate function avg and min, and test cases. [skywalking-banyandb]
Posted by "StLeoX (via GitHub)" <gi...@apache.org>.
StLeoX commented on code in PR #521:
URL: https://github.com/apache/skywalking-banyandb/pull/521#discussion_r1730516032
##########
banyand/measure/aggregate/aggregate_function.go:
##########
@@ -0,0 +1,97 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Package aggregate for measure aggregate function.
+package aggregate
+
+import (
+ "fmt"
+ "math"
+
+ modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
+)
+
+// Void type contains nothing. It works as a placeholder for type parameter.
+type Void struct{}
+
+// MAFInput synchronizes with `pbv1.ValueType`, excluding `ValueTypeUnknown`
+// and `ValueTypeBinaryData`.
+type MAFInput interface {
+ ~string | ~int64 | ~float64 | ~[]string | ~[]int64 | Void
+}
+
+// MAFKeep represents the only two types of value hold by MAF.
+type MAFKeep interface {
+ ~int64 | ~float64
+}
+
+var errFieldValueType = fmt.Errorf("unsupported input value type on this field")
+
+// MAFArgument represents a segment of elements as an argument.
+type MAFArgument[T MAFInput] struct {
Review Comment:
Maybe this struct is unnecessary, should we remove it?
--
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