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

version 2.3.x and 2.4.x do not support .withElementType(DataType.Int32) in the code below. Without this the collection can not be created. #1001

Open
sagpid opened this issue Jul 19, 2024 · 1 comment

Comments

@sagpid
Copy link

sagpid commented Jul 19, 2024

FieldType tagIdsField = FieldType.newBuilder()
.withAutoID(false)
.withDataType(DataType.Array)
.withDescription("tagIds")
.withDimension(0)
.withIsDynamic(false)
.withMaxLength(0)
.withName("tagIds")
.withPartitionKey(false)
.withPrimaryKey(false)
.withTypeParams( typeParams)
.withElementType(DataType.Int32)
.build();

@yhmo
Copy link
Contributor

yhmo commented Jul 29, 2024

withDimension() is for vector field, no need to specify for array field.
withIsDynamic() is for dynamic field, no need to specify for array field.
withMaxLength() is for varchar field, no need to specify for array field.
withPartitionKey() is for partition key field, only varchar/boolean/numeric fields can be partition key, no need to specify for array field.
withTypeParams() is a low-level method used by withMaxLength/withMaxCapacity/withDimension, normally no need to call this method.

To declare an array field, withName/withDataType/withMaxCapacity/withElementType must be specified:

FieldType tagIdsField = FieldType.newBuilder()
                .withDataType(DataType.Array)
                .withDescription("tagIds")
                .withName("tagIds")
                .withMaxCapacity(10)
                .withElementType(DataType.Int32)
                .build();

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