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

enhance: Support Row-based insert for milvusclient #33270

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions client/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ func (c *Client) CreateCollection(ctx context.Context, option CreateCollectionOp
return nil
}

type ListCollectionOption interface {
Request() *milvuspb.ShowCollectionsRequest
}

func (c *Client) ListCollections(ctx context.Context, option ListCollectionOption, callOptions ...grpc.CallOption) (collectionNames []string, err error) {
req := option.Request()
err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
Expand All @@ -82,7 +78,7 @@ func (c *Client) ListCollections(ctx context.Context, option ListCollectionOptio
return collectionNames, err
}

func (c *Client) DescribeCollection(ctx context.Context, option *describeCollectionOption, callOptions ...grpc.CallOption) (collection *entity.Collection, err error) {
func (c *Client) DescribeCollection(ctx context.Context, option DescribeCollectionOption, callOptions ...grpc.CallOption) (collection *entity.Collection, err error) {
req := option.Request()
err = c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
resp, err := milvusService.DescribeCollection(ctx, req, callOptions...)
Expand Down
4 changes: 4 additions & 0 deletions client/collection_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func NewCreateCollectionOption(name string, collectionSchema *entity.Schema) *cr
}
}

type ListCollectionOption interface {
Request() *milvuspb.ShowCollectionsRequest
}

type listCollectionOption struct{}

func (opt *listCollectionOption) Request() *milvuspb.ShowCollectionsRequest {
Expand Down
14 changes: 14 additions & 0 deletions client/entity/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package entity
import (
"strconv"

"github.com/cockroachdb/errors"

"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
)
Expand Down Expand Up @@ -293,6 +295,18 @@ func (f *Field) WithDim(dim int64) *Field {
return f
}

func (f *Field) GetDim() (int64, error) {
dimStr, has := f.TypeParams[TypeParamDim]
if !has {
return -1, errors.New("field with no dim")
}
dim, err := strconv.ParseInt(dimStr, 10, 64)
if err != nil {
return -1, errors.Newf("field with bad format dim: %s", err.Error())
}
return dim, nil
}

func (f *Field) WithMaxLength(maxLen int64) *Field {
if f.TypeParams == nil {
f.TypeParams = make(map[string]string)
Expand Down
2 changes: 1 addition & 1 deletion client/entity/sparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func deserializeSliceSparceEmbedding(bs []byte) (sliceSparseEmbedding, error) {
return sliceSparseEmbedding{}, errors.New("not valid sparse embedding bytes")
}

length = length / 8
length /= 8

result := sliceSparseEmbedding{
positions: make([]uint32, length),
Expand Down
Loading
Loading