From 31ac265ae7e321b4ea7c05d3d6275a33454c2033 Mon Sep 17 00:00:00 2001 From: Manisha4 Date: Wed, 26 Feb 2025 16:27:50 -0800 Subject: [PATCH] Modifying go class and adding back build addition to workflow --- .github/workflows/unit_tests.yml | 2 ++ go/internal/feast/model/sortedfeatureview.go | 29 ++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 758a9958113..b9881f2ea50 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -80,6 +80,8 @@ jobs: - name: Upgrade pip version run: | pip install --upgrade "pip>=22.1,<23" + - name: Upgrade setuptools and wheel + run: pip install --upgrade setuptools wheel - name: Test run: make test-go diff --git a/go/internal/feast/model/sortedfeatureview.go b/go/internal/feast/model/sortedfeatureview.go index 4f5cdefc69a..75405e49bf6 100644 --- a/go/internal/feast/model/sortedfeatureview.go +++ b/go/internal/feast/model/sortedfeatureview.go @@ -4,15 +4,40 @@ import ( "github.com/feast-dev/feast/go/protos/feast/core" ) +type SortOrder struct { + Order core.SortOrder_Enum +} + +func NewSortOrderFromProto(order core.SortOrder_Enum) *SortOrder { + return &SortOrder{ + Order: order, + } +} + +func (so *SortOrder) String() string { + switch so.Order { + case core.SortOrder_ASC: + return "ASC" + case core.SortOrder_DESC: + return "DESC" + default: + return "INVALID" + } +} + +func (so *SortOrder) ToProto() core.SortOrder_Enum { + return so.Order +} + type SortKey struct { FieldName string - Order string + Order *SortOrder } func NewSortKeyFromProto(proto *core.SortKey) *SortKey { return &SortKey{ FieldName: proto.GetName(), - Order: proto.GetDefaultSortOrder().String(), + Order: NewSortOrderFromProto(proto.GetDefaultSortOrder()), } }