Skip to content

Commit

Permalink
feat(substrait) Update to substrait v0.64.0 (#105)
Browse files Browse the repository at this point in the history
* Update proto definition to v0.64.0
* Fixed FetchRel to use OffsetMode and CountMode
  • Loading branch information
srikrishnak authored Jan 15, 2025
1 parent 8c4fdcb commit 18871fb
Show file tree
Hide file tree
Showing 13 changed files with 5,115 additions and 4,122 deletions.
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Package substraitgo contains the experimental go bindings for substrait
// (https://substrait.io).
//
// Current generated proto substrait version: v0.55.0
// Current generated proto substrait version: v0.64.0
package substraitgo

//go:generate buf generate https://github.com/substrait-io/substrait.git#tag=v0.59.0
//go:generate buf generate https://github.com/substrait-io/substrait.git#tag=v0.64.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/substrait-io/substrait v0.63.1 h1:XNPvrEYNPjDqenK4TxqBDDUNzglafdjzjejzQqEwk5Y=
github.com/substrait-io/substrait v0.63.1/go.mod h1:MPFNw6sToJgpD5Z2rj0rQrdP/Oq8HG7Z2t3CAEHtkHw=
github.com/substrait-io/substrait-go v1.2.0 h1:3ZNRkc8FYD7ifCagKEOZQtUcgMceMQfwo2N1NGaK4Q4=
github.com/substrait-io/substrait-go v1.2.0/go.mod h1:IPsy24rdjp/buXR+T8ENl6QCnSCS6h+uM8P+GaZez7c=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
Expand Down
18 changes: 16 additions & 2 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,24 @@ func RelFromProto(rel *proto.Rel, reg expr.ExtensionRegistry) (Rel, error) {
return nil, fmt.Errorf("error getting input to FetchRel: %w", err)
}

var offset int64
if off, ok := rel.Fetch.OffsetMode.(*proto.FetchRel_Offset); ok {
offset = off.Offset
} else {
return nil, fmt.Errorf("%w: missing required Offset field for Fetch Relation", substraitgo.ErrInvalidRel)
}

var count int64
if cnt, ok := rel.Fetch.CountMode.(*proto.FetchRel_Count); ok {
count = cnt.Count
} else {
return nil, fmt.Errorf("%w: missing required Count field for Fetch Relation", substraitgo.ErrInvalidRel)
}

out := &FetchRel{
input: input,
offset: rel.Fetch.Offset,
count: rel.Fetch.Count,
offset: offset,
count: count,
advExtension: rel.Fetch.AdvancedExtension,
}
if rel.Fetch.Common != nil {
Expand Down
12 changes: 8 additions & 4 deletions plan/relations.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,14 @@ func (f *FetchRel) ToProto() *proto.Rel {
return &proto.Rel{
RelType: &proto.Rel_Fetch{
Fetch: &proto.FetchRel{
Common: f.toProto(),
Input: f.input.ToProto(),
Offset: f.offset,
Count: f.count,
Common: f.toProto(),
Input: f.input.ToProto(),
OffsetMode: &proto.FetchRel_Offset{
Offset: f.offset,
},
CountMode: &proto.FetchRel_Count{
Count: f.count,
},
AdvancedExtension: f.advExtension,
},
},
Expand Down
Loading

0 comments on commit 18871fb

Please sign in to comment.