Skip to content

Commit

Permalink
Implement StructValue proto serde without google.protobuf.Value (#343)
Browse files Browse the repository at this point in the history
Move away from google.protobuf.Value. It makes things unnecessary
complicated - number is always f64, look at the previous logic for
handling struct.... It seems like the Value models JSON value which is
not what we need.

I considered using google.protobuf wrappers, e.g. BytesValue,
Int32Value, instead of primitives but those are also for usage with JSON
or with proto2 (before optional was introduced to enable optional
primitive fields), so decided to use proto primitives.

Adds to proto and try from proto.
  • Loading branch information
delta003 authored Jun 9, 2024
1 parent 681e7b3 commit 0e83666
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 262 deletions.
19 changes: 18 additions & 1 deletion vortex-scalar/proto/vortex/scalar/scalar.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,29 @@ package vortex.scalar;

import "vortex/dtype/dtype.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";

message Scalar {
vortex.dtype.DType dtype = 1;
ScalarValue value = 2;
}

message ScalarValue {
google.protobuf.Value value = 1;
oneof kind {
google.protobuf.NullValue null_value = 1;
bool bool_value = 2;
int32 int32_value = 3;
int64 int64_value = 4;
uint32 uint32_value = 5;
uint64 uint64_value = 6;
float float_value = 7;
double double_value = 8;
string string_value = 9;
bytes bytes_value = 10;
ListValue list_value = 12;
}
}

message ListValue {
repeated ScalarValue values = 1;
}
Loading

0 comments on commit 0e83666

Please sign in to comment.