From a091ac0c3efa7305288ae9fb8853bffb2186583a Mon Sep 17 00:00:00 2001 From: Gao Hongtao Date: Thu, 9 May 2024 08:02:18 +0800 Subject: [PATCH] Change default null value (#443) --- banyand/measure/query.go | 17 +---------------- banyand/stream/query.go | 15 +-------------- pkg/pb/v1/metadata.go | 12 ------------ test/cases/topn/data/want/null_group.yaml | 3 +-- test/e2e-v2/script/env | 12 ++++++------ test/stress/classic/env | 12 ++++++------ test/stress/classic/env.dev | 12 ++++++------ 7 files changed, 21 insertions(+), 62 deletions(-) diff --git a/banyand/measure/query.go b/banyand/measure/query.go index 5a68d22b1..88a918805 100644 --- a/banyand/measure/query.go +++ b/banyand/measure/query.go @@ -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: @@ -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: diff --git a/banyand/stream/query.go b/banyand/stream/query.go index da8827f39..4204c55f8 100644 --- a/banyand/stream/query.go +++ b/banyand/stream/query.go @@ -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: diff --git a/pkg/pb/v1/metadata.go b/pkg/pb/v1/metadata.go index cdae269cd..dce4d8321 100644 --- a/pkg/pb/v1/metadata.go +++ b/pkg/pb/v1/metadata.go @@ -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{}}} ) diff --git a/test/cases/topn/data/want/null_group.yaml b/test/cases/topn/data/want/null_group.yaml index b39f77e7e..166de533b 100644 --- a/test/cases/topn/data/want/null_group.yaml +++ b/test/cases/topn/data/want/null_group.yaml @@ -44,8 +44,7 @@ lists: - entity: - key: service_id value: - str: - value: "" + "null": null - key: entity_id value: str: diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env index f77b10113..c12d1eea2 100644 --- a/test/e2e-v2/script/env +++ b/test/e2e-v2/script/env @@ -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 diff --git a/test/stress/classic/env b/test/stress/classic/env index 905291396..8915bf5fc 100644 --- a/test/stress/classic/env +++ b/test/stress/classic/env @@ -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 diff --git a/test/stress/classic/env.dev b/test/stress/classic/env.dev index 86eea5120..b4cca887d 100644 --- a/test/stress/classic/env.dev +++ b/test/stress/classic/env.dev @@ -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