hanahmily commented on code in PR #246:
URL: 
https://github.com/apache/skywalking-banyandb/pull/246#discussion_r1094042537


##########
banyand/metadata/schema/measure.go:
##########
@@ -59,11 +61,21 @@ func (e *etcdSchemaRegistry) ListMeasure(ctx 
context.Context, opt ListOpt) ([]*d
 }
 
 func (e *etcdSchemaRegistry) CreateMeasure(ctx context.Context, measure 
*databasev1.Measure) error {
+       if measure.UpdatedAt != nil {
+               measure.UpdatedAt = timestamppb.Now()
+       }
+       if measure.GetInterval() != "" {
+               _, timeError := timestamp.ParseDuration(measure.GetInterval())
+               if timeError != nil {
+                       return errors.New("format of interval filed error")
+               }
+       }
+       name := measure.GetMetadata().GetName()

Review Comment:
   Why assign a local variable `name`? It seems not reused.



##########
banyand/metadata/schema/measure.go:
##########
@@ -59,11 +61,21 @@ func (e *etcdSchemaRegistry) ListMeasure(ctx 
context.Context, opt ListOpt) ([]*d
 }
 
 func (e *etcdSchemaRegistry) CreateMeasure(ctx context.Context, measure 
*databasev1.Measure) error {
+       if measure.UpdatedAt != nil {
+               measure.UpdatedAt = timestamppb.Now()
+       }
+       if measure.GetInterval() != "" {
+               _, timeError := timestamp.ParseDuration(measure.GetInterval())
+               if timeError != nil {
+                       return errors.New("format of interval filed error")

Review Comment:
   ```suggestion
                if _, err := timestamp.ParseDuration(measure.GetInterval()); 
err != nil {
                        return errors.Wrap(err, "interval is malformed")
   ```



##########
banyand/metadata/schema/measure.go:
##########
@@ -126,6 +138,12 @@ func (e *etcdSchemaRegistry) CreateMeasure(ctx 
context.Context, measure *databas
 }
 
 func (e *etcdSchemaRegistry) UpdateMeasure(ctx context.Context, measure 
*databasev1.Measure) error {
+       if measure.GetInterval() != "" {
+               _, timeError := timestamp.ParseDuration(measure.GetInterval())
+               if timeError != nil {
+                       return errors.New("format of interval filed error")
+               }

Review Comment:
   Same as above



##########
banyand/metadata/schema/property.go:
##########
@@ -86,10 +87,18 @@ func (e *etcdSchemaRegistry) ListProperty(ctx 
context.Context, container *common
 
 func (e *etcdSchemaRegistry) ApplyProperty(ctx context.Context, property 
*propertyv1.Property, strategy propertyv1.ApplyRequest_Strategy) (bool, uint32, 
error) {
        m := transformKey(property.GetMetadata())
+       group := m.GetGroup()
+       _, getGroupErr := e.GetGroup(ctx, group)
+       if getGroupErr != nil {
+               return false, 0, getGroupErr

Review Comment:
   Wrap a relevant message around the error.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to