Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add golang SDK #261

Merged
merged 4 commits into from
Oct 21, 2019
Merged

[WIP] Add golang SDK #261

merged 4 commits into from
Oct 21, 2019

Conversation

zhilingc
Copy link
Collaborator

@zhilingc zhilingc commented Oct 17, 2019

Addresses #260 .

Some considerations:

  • The protobuf defined request and response payloads are not very user friendly, so we need wrappers around them
  • Performance is of great importance for this SDK so we want to avoid reflection as much as possible
  • Most feast usecases deal with single-type arrays of features, but there are usecases that involve mixed type outputs, so we have to support both

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhilingc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zhilingc
Copy link
Collaborator Author

Usage example for the current iteration:

client, err := NewGrpcClient("localhost", 6565)
if err != nil {
	panic(err)
}
ctx := context.Background()
response, err := client.GetOnlineFeatures(ctx, &OnlineFeaturesRequest{
	Features:      []string{"fs:1:feature1", "fs:1:feature2"},
	MaxAgeSeconds: 100,
	Entities: []Row{
		{"s2id": Int64Val(1)},
		{"s2id": Int64Val(2)},
	},
})
if err != nil {
	panic(err)
}

// just retrieve rows
// returns map[string]*types.Value
_ = response.Rows()

// use convenience functions to get arrays
// returns [][]int64
_, err = response.Int64Arrays([]string{"fs:1:feature1", "fs:1:feature2"}, []int64{-1, -1})

Copy link
Member

@woop woop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good! I like the construction of the request

sdk/go/request.go Outdated Show resolved Hide resolved
sdk/go/request.go Outdated Show resolved Hide resolved
sdk/go/request.go Outdated Show resolved Hide resolved
@feast-ci-bot
Copy link
Collaborator

@zhilingc: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
integration-test 4821cf5 link /test integration-test
unit-test-cli 4821cf5 link /test unit-test-cli
unit-test-ingestion 4821cf5 link /test unit-test-ingestion

Full PR test history

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@woop woop merged commit e8a9fae into feast-dev:0.3-dev Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants