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

Remove unsupported index types #723

Merged
merged 1 commit into from
Dec 27, 2023
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: 3 additions & 3 deletions tests/milvustest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@
<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<version>2.2.6</version>
<version>2.2.15</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.19.2</version>
</dependency>
</dependency>-->
<!--Allure-->
<dependency>
<groupId>io.qameta.allure</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,21 +474,21 @@ public static String provideExtraParam(IndexType indexType) {
case IVF_PQ:
extraParm = "{\"nlist\":128, \"m\":16, \"nbits\":8}";
break;
case ANNOY:
/*case ANNOY:
extraParm = "{\"n_trees\":16}";
break;
break;*/
case HNSW:
extraParm = "{\"M\":16,\"efConstruction\":64}";
break;
case RHNSW_FLAT:
/* case RHNSW_FLAT:
extraParm = "{\"M\":16,\"efConstruction\":64}";
break;
case RHNSW_PQ:
extraParm = "{\"M\":16,\"efConstruction\":64, \"PQM\":16}";
break;
case RHNSW_SQ:
break;*/
/* case RHNSW_SQ:
extraParm = "{\"M\":16,\"efConstruction\":64}";
break;
break;*/
case BIN_IVF_FLAT:
extraParm = "";
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public Object[][] provideIndexType() {
{IndexType.IVF_SQ8},
{IndexType.IVF_PQ},
{IndexType.HNSW},
{IndexType.ANNOY},
/* {IndexType.ANNOY},
{IndexType.RHNSW_FLAT},
{IndexType.RHNSW_PQ},
{IndexType.RHNSW_SQ},
{IndexType.RHNSW_SQ},*/
{IndexType.DISKANN}
};
}
Expand All @@ -69,10 +69,10 @@ public Object[][] providerMetricType() {
public Object[][] providerBinaryMetricType() {
return new Object[][] {
{MetricType.HAMMING},
{MetricType.JACCARD},
{MetricType.JACCARD}/*,
{MetricType.SUBSTRUCTURE},
{MetricType.SUPERSTRUCTURE},
{MetricType.TANIMOTO}
{MetricType.TANIMOTO}*/
};
}

Expand Down Expand Up @@ -142,11 +142,11 @@ public void createIndexAsync(IndexType indexType, MetricType metricType) {
@Issue("https://github.com/milvus-io/milvus-sdk-java/issues/321")
@Test(description = "Create index for collection Async", dataProvider = "BinaryIndex")
public void createBinaryIndexAsync(IndexType indexType, MetricType metricType) {
if (indexType.equals(IndexType.BIN_IVF_FLAT)
/* if (indexType.equals(IndexType.BIN_IVF_FLAT)
&& (metricType.equals(MetricType.SUBSTRUCTURE)
|| metricType.equals(MetricType.SUPERSTRUCTURE))) {
return;
}
}*/
R<RpcStatus> rpcStatusR =
milvusClient.createIndex(
CreateIndexParam.newBuilder()
Expand All @@ -172,11 +172,11 @@ public void createBinaryIndexAsync(IndexType indexType, MetricType metricType) {
@Issue("https://github.com/milvus-io/milvus-sdk-java/issues/321")
@Test(description = "Create index for collection sync", dataProvider = "BinaryIndex")
public void createBinaryIndexSync(IndexType indexType, MetricType metricType) {
if (indexType.equals(IndexType.BIN_IVF_FLAT)
/*if (indexType.equals(IndexType.BIN_IVF_FLAT)
&& (metricType.equals(MetricType.SUBSTRUCTURE)
|| metricType.equals(MetricType.SUPERSTRUCTURE))) {
return;
}
}*/
R<RpcStatus> rpcStatusR =
milvusClient.createIndex(
CreateIndexParam.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public Object[][] provideIndexType() {
{IndexType.IVF_FLAT},
{IndexType.IVF_SQ8},
{IndexType.IVF_PQ},
{IndexType.HNSW},
{IndexType.HNSW}/*,
{IndexType.ANNOY},
{IndexType.RHNSW_FLAT},
{IndexType.RHNSW_PQ},
{IndexType.RHNSW_SQ}
{IndexType.RHNSW_SQ}*/
};
}

Expand All @@ -71,10 +71,10 @@ public Object[][] providerMetricType() {
public Object[][] providerBinaryMetricType() {
return new Object[][] {
{MetricType.HAMMING},
{MetricType.JACCARD},
{MetricType.JACCARD}/*,
{MetricType.SUBSTRUCTURE},
{MetricType.SUPERSTRUCTURE},
{MetricType.TANIMOTO}
{MetricType.TANIMOTO}*/
};
}

Expand Down Expand Up @@ -162,11 +162,11 @@ public void createIndexAfterLoadFloatCollection(IndexType indexType, MetricType
@Severity(SeverityLevel.NORMAL)
@Test(description = "Test create/drop index when collection is loaded for binary vector", dataProvider = "BinaryIndex",groups = {"Smoke"})
public void createIndexAfterLoadBinaryCollection(IndexType indexType, MetricType metricType) {
if (indexType.equals(IndexType.BIN_IVF_FLAT)
/* if (indexType.equals(IndexType.BIN_IVF_FLAT)
&& (metricType.equals(MetricType.SUBSTRUCTURE)
|| metricType.equals(MetricType.SUPERSTRUCTURE))) {
return;
}
}*/
// 1. create index params
CreateIndexParam createIndexParams = CreateIndexParam.newBuilder()
.withCollectionName(binaryCollection)
Expand Down Expand Up @@ -234,4 +234,49 @@ public void createIndexAfterLoadBinaryCollection(IndexType indexType, MetricType
Assert.assertEquals(rpcStatusR7.getStatus().intValue(), 0);
Assert.assertEquals(rpcStatusR7.getData().getMsg(), "Success");
}

@Test
public void repeatCreateIndex(){
String collection = CommonFunction.createNewCollection();
// 1. create index params
CreateIndexParam createIndexParams = CreateIndexParam.newBuilder()
.withCollectionName(collection)
.withFieldName(CommonData.defaultVectorField)
.withMetricType(MetricType.L2)
.withIndexType(IndexType.HNSW)
.withExtraParam(CommonFunction.provideExtraParam(IndexType.HNSW))
.withSyncMode(Boolean.TRUE)
.withSyncWaitingTimeout(30L)
.withSyncWaitingInterval(500L)
.build();
// 2. create index
R<RpcStatus> rpcStatusR = milvusClient.createIndex(createIndexParams);
System.out.println("Create index" + rpcStatusR);
Assert.assertEquals(rpcStatusR.getStatus().intValue(), 0);
Assert.assertEquals(rpcStatusR.getData().getMsg(), "Success");
// 3. load collection
R<RpcStatus> rpcStatusR2 = milvusClient.loadCollection(
LoadCollectionParam.newBuilder()
.withCollectionName(collection)
.withSyncLoad(Boolean.TRUE)
.build());
System.out.println("Load collection " + rpcStatusR);
Assert.assertEquals(rpcStatusR2.getStatus().intValue(), 0);
Assert.assertEquals(rpcStatusR2.getData().getMsg(), "Success");
// repeat createIndex
CreateIndexParam createIndexParams2 = CreateIndexParam.newBuilder()
.withCollectionName(collection)
.withFieldName(CommonData.defaultVectorField)
.withMetricType(MetricType.L2)
.withIndexType(IndexType.IVF_FLAT)
.withExtraParam(CommonFunction.provideExtraParam(IndexType.IVF_FLAT))
.withSyncMode(Boolean.TRUE)
.withSyncWaitingTimeout(30L)
.withSyncWaitingInterval(500L)
.build();
R<RpcStatus> rpcStatusR3 = milvusClient.createIndex(createIndexParams2);
System.out.println("Create index" + rpcStatusR2);
Assert.assertEquals(rpcStatusR3.getStatus().intValue(), 0);
Assert.assertEquals(rpcStatusR3.getData().getMsg(), "Success");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public Object[][] provideIndexType() {
{IndexType.IVF_FLAT},
{IndexType.IVF_SQ8},
{IndexType.IVF_PQ},
{IndexType.HNSW},
{IndexType.HNSW}/*,
{IndexType.ANNOY},
{IndexType.RHNSW_FLAT},
{IndexType.RHNSW_PQ},
{IndexType.RHNSW_SQ}
{IndexType.RHNSW_SQ}*/
};
}

Expand All @@ -129,10 +129,10 @@ public Object[][] provideBinaryIndexType() {
public Object[][] providerBinaryMetricType() {
return new Object[][] {
{MetricType.HAMMING},
{MetricType.JACCARD},
{MetricType.JACCARD}/*,
{MetricType.SUBSTRUCTURE},
{MetricType.SUPERSTRUCTURE},
{MetricType.TANIMOTO}
{MetricType.TANIMOTO}*/
};
}

Expand Down Expand Up @@ -807,12 +807,12 @@ public void intPKAndFloatVectorQueryUsingEachIndex(IndexType indexType, MetricTy
@Severity(SeverityLevel.CRITICAL)
public void stringPKAndBinaryVectorQueryUsingEachIndex(
IndexType indexType, MetricType metricType) throws ExecutionException, InterruptedException {
boolean b =
/* boolean b =
metricType.equals(MetricType.SUBSTRUCTURE) || metricType.equals(MetricType.SUPERSTRUCTURE);

if (indexType.equals(IndexType.BIN_IVF_FLAT) && b) {
return;
}
}*/
String stringPKAndBinaryCollection = CommonFunction.createStringPKAndBinaryCollection();
// create index
R<RpcStatus> rpcStatusR =
Expand Down Expand Up @@ -857,9 +857,9 @@ public void stringPKAndBinaryVectorQueryUsingEachIndex(
R<QueryResults> queryResultsR = rListenableFuture.get();
QueryResultsWrapper wrapperQuery = new QueryResultsWrapper(queryResultsR.getData());
Assert.assertEquals(queryResultsR.getStatus().intValue(), 0);
if (b) {
/* if (b) {
return;
}
}*/
System.out.println(wrapperQuery.getFieldWrapper("book_name").getFieldData());
System.out.println(wrapperQuery.getFieldWrapper("book_content").getFieldData());
Assert.assertTrue(wrapperQuery.getFieldWrapper("book_name").getFieldData().size() > 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ public Object[][] provideIndexType() {
{IndexType.IVF_FLAT},
{IndexType.IVF_SQ8},
{IndexType.IVF_PQ},
{IndexType.HNSW},
{IndexType.HNSW}/*,
{IndexType.ANNOY},
{IndexType.RHNSW_FLAT},
{IndexType.RHNSW_PQ},
{IndexType.RHNSW_SQ}
{IndexType.RHNSW_SQ}*/
};
}

Expand All @@ -137,10 +137,10 @@ public Object[][] provideBinaryIndexType() {
public Object[][] providerBinaryMetricType() {
return new Object[][] {
{MetricType.HAMMING},
{MetricType.JACCARD},
{MetricType.JACCARD}/*,
{MetricType.SUBSTRUCTURE},
{MetricType.SUPERSTRUCTURE},
{MetricType.TANIMOTO}
{MetricType.TANIMOTO}*/
};
}

Expand Down Expand Up @@ -818,12 +818,12 @@ public void intPKAndFloatVectorQueryUsingEachIndex(IndexType indexType, MetricTy
@Severity(SeverityLevel.CRITICAL)
public void stringPKAndBinaryVectorQueryUsingEachIndex(
IndexType indexType, MetricType metricType) {
boolean b =
/* boolean b =
metricType.equals(MetricType.SUBSTRUCTURE) || metricType.equals(MetricType.SUPERSTRUCTURE);

if (indexType.equals(IndexType.BIN_IVF_FLAT) && b) {
return;
}
}*/
String stringPKAndBinaryCollection = CommonFunction.createStringPKAndBinaryCollection();
// create index
R<RpcStatus> rpcStatusR =
Expand Down Expand Up @@ -867,9 +867,9 @@ public void stringPKAndBinaryVectorQueryUsingEachIndex(
R<QueryResults> queryResultsR = milvusClient.query(queryParam);
QueryResultsWrapper wrapperQuery = new QueryResultsWrapper(queryResultsR.getData());
Assert.assertEquals(queryResultsR.getStatus().intValue(), 0);
if (b) {
/* if (b) {
return;
}
}*/
System.out.println(wrapperQuery.getFieldWrapper("book_name").getFieldData());
System.out.println(wrapperQuery.getFieldWrapper("book_content").getFieldData());
Assert.assertTrue(wrapperQuery.getFieldWrapper("book_name").getFieldData().size() > 10);
Expand Down Expand Up @@ -1121,9 +1121,6 @@ public void queryCollectionWithJsonField(String expr) {
QueryResultsWrapper wrapperQuery = new QueryResultsWrapper(queryResultsR.getData());
Assert.assertEquals(queryResultsR.getStatus().intValue(), 0);
Assert.assertTrue(wrapperQuery.getFieldWrapper("json_field").getFieldData().size()>=4);
JSONObject jsonObject = (JSONObject) wrapperQuery.getRowRecord(0).get("json_field");
String string_field = jsonObject.getString("string_field");
Assert.assertTrue(string_field.contains("Str"));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public Object[][] provideIndexType() {
{IndexType.IVF_FLAT},
{IndexType.IVF_SQ8},
{IndexType.IVF_PQ},
{IndexType.HNSW},
{IndexType.HNSW}/*,
{IndexType.ANNOY},
{IndexType.RHNSW_FLAT},
{IndexType.RHNSW_PQ},
{IndexType.RHNSW_SQ}
{IndexType.RHNSW_SQ}*/
};
}

Expand All @@ -129,10 +129,10 @@ public Object[][] provideBinaryIndexType() {
public Object[][] providerBinaryMetricType() {
return new Object[][] {
{MetricType.HAMMING},
{MetricType.JACCARD},
{MetricType.JACCARD}/*,
{MetricType.SUBSTRUCTURE},
{MetricType.SUPERSTRUCTURE},
{MetricType.TANIMOTO}
{MetricType.TANIMOTO}*/
};
}

Expand Down Expand Up @@ -1655,11 +1655,11 @@ public void intPKAndFloatVectorSearchAsyncWithEachIndex(
dataProvider = "BinaryIndex")
public void stringPKAndBinaryVectorSearchAsyncWithEachIndex(
IndexType indexType, MetricType metricType) {
boolean b =
metricType.equals(MetricType.SUBSTRUCTURE) || metricType.equals(MetricType.SUPERSTRUCTURE);
if (indexType.equals(IndexType.BIN_IVF_FLAT) && b) {
/*boolean b =
metricType.equals(MetricType.SUBSTRUCTURE) || metricType.equals(MetricType.SUPERSTRUCTURE);*/
/* if (indexType.equals(IndexType.BIN_IVF_FLAT) && b) {
return;
}
}*/
String stringPKAndBinaryCollection = CommonFunction.createStringPKAndBinaryCollection();
// create index
R<RpcStatus> rpcStatusR =
Expand Down Expand Up @@ -1710,9 +1710,9 @@ public void stringPKAndBinaryVectorSearchAsyncWithEachIndex(
ListenableFuture<R<SearchResults>> rListenableFuture = milvusClient.searchAsync(searchParam);
try {
Assert.assertEquals(rListenableFuture.get().getStatus().intValue(), 0);
if (b) {
/* if (b) {
return;
}
}*/
SearchResultsWrapper searchResultsWrapper =
new SearchResultsWrapper(rListenableFuture.get().getData().getResults());
Assert.assertEquals(searchResultsWrapper.getFieldData("book_name", 0).size(), 2);
Expand Down
Loading
Loading