Skip to content

Commit

Permalink
Change default null value (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahmily authored May 9, 2024
1 parent acd2f4c commit a091ac0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 62 deletions.
17 changes: 1 addition & 16 deletions banyand/measure/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,7 @@ func (s *measure) parseTagProjection(qo queryOptions, result *queryResult) (proj

func mustDecodeTagValue(valueType pbv1.ValueType, value []byte) *modelv1.TagValue {
if value == nil {
switch valueType {
case pbv1.ValueTypeInt64:
logger.Panicf("int64 can be nil")
case pbv1.ValueTypeStr:
return pbv1.EmptyStrTagValue
case pbv1.ValueTypeStrArr:
return pbv1.EmptyStrArrTagValue
case pbv1.ValueTypeInt64Arr:
return pbv1.EmptyIntArrTagValue
case pbv1.ValueTypeBinaryData:
return pbv1.EmptyBinaryTagValue
default:
return pbv1.NullTagValue
}
return pbv1.NullTagValue
}
switch valueType {
case pbv1.ValueTypeInt64:
Expand Down Expand Up @@ -312,8 +299,6 @@ func strArrTagValue(values []string) *modelv1.TagValue {
func mustDecodeFieldValue(valueType pbv1.ValueType, value []byte) *modelv1.FieldValue {
if value == nil {
switch valueType {
case pbv1.ValueTypeInt64, pbv1.ValueTypeFloat64:
logger.Panicf("int64 and float64 can't be nil")
case pbv1.ValueTypeStr:
return pbv1.EmptyStrFieldValue
case pbv1.ValueTypeBinaryData:
Expand Down
15 changes: 1 addition & 14 deletions banyand/stream/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,7 @@ func mustEncodeTagValue(name string, tagType databasev1.TagType, tagValue *model

func mustDecodeTagValue(valueType pbv1.ValueType, value []byte) *modelv1.TagValue {
if value == nil {
switch valueType {
case pbv1.ValueTypeInt64:
logger.Panicf("int64 can be nil")
case pbv1.ValueTypeStr:
return pbv1.EmptyStrTagValue
case pbv1.ValueTypeStrArr:
return pbv1.EmptyStrArrTagValue
case pbv1.ValueTypeInt64Arr:
return pbv1.EmptyIntArrTagValue
case pbv1.ValueTypeBinaryData:
return pbv1.EmptyBinaryTagValue
default:
return pbv1.NullTagValue
}
return pbv1.NullTagValue
}
switch valueType {
case pbv1.ValueTypeInt64:
Expand Down
12 changes: 0 additions & 12 deletions pkg/pb/v1/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,4 @@ var (

// NullTagValue represents a null tag value in the model.
NullTagValue = &modelv1.TagValue{Value: &modelv1.TagValue_Null{}}

// EmptyStrTagValue represents an empty string tag value in the model.
EmptyStrTagValue = &modelv1.TagValue{Value: &modelv1.TagValue_Str{Str: &modelv1.Str{Value: ""}}}

// EmptyStrArrTagValue represents an empty string array tag value in the model.
EmptyStrArrTagValue = &modelv1.TagValue{Value: &modelv1.TagValue_StrArray{StrArray: &modelv1.StrArray{Value: []string{}}}}

// EmptyIntArrTagValue represents an empty integer array tag value in the model.
EmptyIntArrTagValue = &modelv1.TagValue{Value: &modelv1.TagValue_IntArray{IntArray: &modelv1.IntArray{Value: []int64{}}}}

// EmptyBinaryTagValue represents an empty binary tag value in the model.
EmptyBinaryTagValue = &modelv1.TagValue{Value: &modelv1.TagValue_BinaryData{BinaryData: []byte{}}}
)
3 changes: 1 addition & 2 deletions test/cases/topn/data/want/null_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ lists:
- entity:
- key: service_id
value:
str:
value: ""
"null": null
- key: entity_id
value:
str:
Expand Down
12 changes: 6 additions & 6 deletions test/e2e-v2/script/env
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

SW_AGENT_JAVA_COMMIT=3f88d735ba2bfd1196aff946502447d4b14450c8
SW_AGENT_JAVA_COMMIT=c82287e1dd1593cf3e7dbc390b92f9224943252a
SW_AGENT_SATELLITE_COMMIT=ea27a3f4e126a24775fe12e2aa2695bcb23d99c3
SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa
SW_AGENT_NODEJS_COMMIT=2e7560518aff846befd4d6bc815fe5e38c704a11
SW_AGENT_GO_COMMIT=4af380c2db6243106b0fc650b6003ce3b3eb82a0
SW_AGENT_NODEJS_COMMIT=4f9a91dad3dfd8cfe5ba8f7bd06b39e11eb5e65e
SW_AGENT_GO_COMMIT=774a6d56baba1187eb03bf1861af542c923b3dff
SW_AGENT_PYTHON_COMMIT=c76a6ec51a478ac91abb20ec8f22a99b8d4d6a58
SW_AGENT_CLIENT_JS_COMMIT=af0565a67d382b683c1dbd94c379b7080db61449
SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
SW_KUBERNETES_COMMIT_SHA=e2c61c6774cf377b23516fca6f8a1e119d3191c5
SW_KUBERNETES_COMMIT_SHA=3eb9fc8235fd3a773650d1f08adfccfd5d0745fc
SW_ROVER_COMMIT=fc8d074c6d34ecfee585a7097cbd5aef1ca680a5
SW_CTL_COMMIT=6b2eb0011e38b630db6af7203db215806bd141ed
SW_CTL_COMMIT=d5f3597733aa5217373986d776a3ee5ee8b3c468

SW_OAP_COMMIT=ad80d9cca7a862b719f7dd8229cb9bfe01b77c3c
SW_OAP_COMMIT=ec43d99ead86c7a4d3a7cd8083828471cfb81dbc
SW_AGENT_E2E_SERVICE_PROVIDER_COMMIT=cc7a2c9e97fd2c421adbe3e9c471688459a446d9
12 changes: 6 additions & 6 deletions test/stress/classic/env
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
# limitations under the License.


SW_AGENT_JAVA_COMMIT=3f88d735ba2bfd1196aff946502447d4b14450c8
SW_AGENT_JAVA_COMMIT=c82287e1dd1593cf3e7dbc390b92f9224943252a
SW_AGENT_SATELLITE_COMMIT=ea27a3f4e126a24775fe12e2aa2695bcb23d99c3
SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa
SW_AGENT_NODEJS_COMMIT=2e7560518aff846befd4d6bc815fe5e38c704a11
SW_AGENT_GO_COMMIT=4af380c2db6243106b0fc650b6003ce3b3eb82a0
SW_AGENT_NODEJS_COMMIT=4f9a91dad3dfd8cfe5ba8f7bd06b39e11eb5e65e
SW_AGENT_GO_COMMIT=774a6d56baba1187eb03bf1861af542c923b3dff
SW_AGENT_PYTHON_COMMIT=c76a6ec51a478ac91abb20ec8f22a99b8d4d6a58
SW_AGENT_CLIENT_JS_COMMIT=af0565a67d382b683c1dbd94c379b7080db61449
SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
SW_KUBERNETES_COMMIT_SHA=e2c61c6774cf377b23516fca6f8a1e119d3191c5
SW_KUBERNETES_COMMIT_SHA=3eb9fc8235fd3a773650d1f08adfccfd5d0745fc
SW_ROVER_COMMIT=fc8d074c6d34ecfee585a7097cbd5aef1ca680a5
SW_CTL_COMMIT=6b2eb0011e38b630db6af7203db215806bd141ed
SW_CTL_COMMIT=d5f3597733aa5217373986d776a3ee5ee8b3c468

SW_OAP_COMMIT=ad80d9cca7a862b719f7dd8229cb9bfe01b77c3c
SW_OAP_COMMIT=ec43d99ead86c7a4d3a7cd8083828471cfb81dbc
SW_AGENT_E2E_SERVICE_PROVIDER_COMMIT=cc7a2c9e97fd2c421adbe3e9c471688459a446d9

VUS=10
12 changes: 6 additions & 6 deletions test/stress/classic/env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

SW_AGENT_JAVA_COMMIT=3f88d735ba2bfd1196aff946502447d4b14450c8
SW_AGENT_JAVA_COMMIT=c82287e1dd1593cf3e7dbc390b92f9224943252a
SW_AGENT_SATELLITE_COMMIT=ea27a3f4e126a24775fe12e2aa2695bcb23d99c3
SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa
SW_AGENT_NODEJS_COMMIT=2e7560518aff846befd4d6bc815fe5e38c704a11
SW_AGENT_GO_COMMIT=4af380c2db6243106b0fc650b6003ce3b3eb82a0
SW_AGENT_NODEJS_COMMIT=4f9a91dad3dfd8cfe5ba8f7bd06b39e11eb5e65e
SW_AGENT_GO_COMMIT=774a6d56baba1187eb03bf1861af542c923b3dff
SW_AGENT_PYTHON_COMMIT=c76a6ec51a478ac91abb20ec8f22a99b8d4d6a58
SW_AGENT_CLIENT_JS_COMMIT=af0565a67d382b683c1dbd94c379b7080db61449
SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
SW_KUBERNETES_COMMIT_SHA=e2c61c6774cf377b23516fca6f8a1e119d3191c5
SW_KUBERNETES_COMMIT_SHA=3eb9fc8235fd3a773650d1f08adfccfd5d0745fc
SW_ROVER_COMMIT=fc8d074c6d34ecfee585a7097cbd5aef1ca680a5
SW_CTL_COMMIT=6b2eb0011e38b630db6af7203db215806bd141ed
SW_CTL_COMMIT=d5f3597733aa5217373986d776a3ee5ee8b3c468

SW_OAP_COMMIT=ad80d9cca7a862b719f7dd8229cb9bfe01b77c3c
SW_OAP_COMMIT=ec43d99ead86c7a4d3a7cd8083828471cfb81dbc
SW_AGENT_E2E_SERVICE_PROVIDER_COMMIT=cc7a2c9e97fd2c421adbe3e9c471688459a446d9

VUS=1

0 comments on commit a091ac0

Please sign in to comment.