Skip to content

构建CreateCollectionReq出现indexParams$value=null导致空指针异常 #1470

@yeyinglang

Description

@yeyinglang

现象

java版本:jdk11
milvus-sdk-java版本: 2.6.0

Image

报错堆栈的代码触发点

Image

复现代码

     ConnectConfig config = ConnectConfig.builder()
                .connectTimeoutMs(1000).uri("http://localhost:19530").build();
        MilvusClientV2 milvusClientV2 = new MilvusClientV2(config);
        String collectionName = "test_java_collection";

        FieldSchema primaryKey = FieldSchema.builder().name("id")
                .autoID(true)
                .dataType(DataType.Int64)
                .isPrimaryKey(true)
                .build();

        FieldSchema textField = FieldSchema.builder().name("text")
                .dataType(DataType.VarChar)
                .maxLength(512)
                .build();

        FieldSchema vectorField = FieldSchema.builder().name("vector")
                .dataType(DataType.FloatVector)
                .dimension(128)
                .build();

        IndexParam indexParam = IndexParam.builder()
                .indexName("vector_idx")
                .indexType(IndexType.AUTOINDEX)
                .metricType(MetricType.L2)
                .fieldName("vector").build();

        CollectionSchema collectionSchema = CollectionSchema.builder().fieldSchemaList(Arrays.asList(primaryKey,textField,vectorField)).build();
        CreateCollectionReq createCollectionReq = CreateCollectionReq.builder()
                .collectionName(collectionName)
                .collectionSchema(collectionSchema)
                .indexParam(indexParam)
                .build();

        milvusClientV2.createCollection(createCollectionReq);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions