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

[Bug]: reflectValueCandi array error #734

Open
1 task done
extrame opened this issue Apr 24, 2024 · 1 comment
Open
1 task done

[Bug]: reflectValueCandi array error #734

extrame opened this issue Apr 24, 2024 · 1 comment

Comments

@extrame
Copy link

extrame commented Apr 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

v = v.Slice(0, v.Len()-1)

reflectValueCandi reflect array of wrong length, it trim the last byte.

If I define a struct like:

type PromptTemplate struct {
	Id int64 `xorm:"pk autoincr" json:"id" milvus:"primary_key;name:id"`
	CreatedAt time.Time `json:"created_at" xorm:"created" milvus:"-"`
	ActionType  int32        `json:"action_type" milvus:"name:action_type"`
	ProcessCode string       `json:"process_code" milvus:"name:process_code"`
	Vectors     [384]float32 `milvus:"name:prompt_vector" json:"-" xorm:"-"` //用于存储向量
}

It will reflect Vectors to 383 lengths slice.

remove -1 in

v = v.Slice(0, v.Len()-1)

will fix the bug

Expected Behavior

It should reflect Vectors to 384 lengths slice.

Steps To Reproduce

Define a type with array like:

type PromptTemplate struct {
	Id int64 `xorm:"pk autoincr" json:"id" milvus:"primary_key;name:id"`
	CreatedAt time.Time `json:"created_at" xorm:"created" milvus:"-"`
	ActionType  int32        `json:"action_type" milvus:"name:action_type"`
	ProcessCode string       `json:"process_code" milvus:"name:process_code"`
	Vectors     [384]float32 `milvus:"name:prompt_vector" json:"-" xorm:"-"` //用于存储向量
}

call InsertRows to insert objects of the test type like:

_, err = mclient.InsertRows(
		context.Background(), // ctx
		"cpzx_rag_prompt",    // CollectionName
		"",                   // partitionName
		interfaces,           // rows
	)
	return err

It will show a error like

the length(383) of float data should divide the dim(384)


### Environment

_No response_

### Anything else?

_No response_
@congqixia
Copy link
Contributor

Thanks for pointing this out! I'll fix this asap

congqixia added a commit to congqixia/milvus-sdk-go that referenced this issue Apr 24, 2024
congqixia added a commit to congqixia/milvus-sdk-go that referenced this issue Apr 26, 2024
sre-ci-robot pushed a commit that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants