(fix)(headless)Fix hash code issue of MetricSchemaResp and DimensionSchemaResp.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled

This commit is contained in:
jerryjzhang
2025-03-29 22:42:27 +08:00
parent 232a202275
commit 1fed8ca4d9
6 changed files with 36 additions and 15 deletions

View File

@@ -66,8 +66,8 @@ public class S2OnnxEmbeddingModel extends AbstractInProcessEmbeddingModel {
static OnnxBertBiEncoder loadFromFileSystem(Path pathToModel, URL vocabularyFile) {
try {
return new OnnxBertBiEncoder(Files.newInputStream(pathToModel), vocabularyFile.openStream(),
PoolingMode.MEAN);
return new OnnxBertBiEncoder(Files.newInputStream(pathToModel),
vocabularyFile.openStream(), PoolingMode.MEAN);
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@@ -81,13 +81,13 @@ public class MilvusEmbeddingStore implements EmbeddingStore<TextSegment> {
// Define the field structure for the collection
this.fieldDefinition = new FieldDefinition(ID_FIELD_NAME, TEXT_FIELD_NAME,
METADATA_FIELD_NAME, VECTOR_FIELD_NAME);
METADATA_FIELD_NAME, VECTOR_FIELD_NAME);
if (!hasCollection(this.milvusClient, this.collectionName)) {
createCollection(this.milvusClient, this.collectionName, fieldDefinition,
ensureNotNull(dimension, "dimension"));
ensureNotNull(dimension, "dimension"));
createIndex(this.milvusClient, this.collectionName, VECTOR_FIELD_NAME,
getOrDefault(indexType, FLAT), this.metricType);
getOrDefault(indexType, FLAT), this.metricType);
}
loadCollectionInMemory(this.milvusClient, collectionName);

View File

@@ -1,6 +1,5 @@
package com.tencent.supersonic.headless.api.pojo;
import com.google.common.base.Objects;
import com.tencent.supersonic.common.pojo.RecordInfo;
import com.tencent.supersonic.common.pojo.enums.SensitiveLevelEnum;
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
@@ -10,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@Data
@ToString(callSuper = true)
@@ -40,13 +40,13 @@ public class SchemaItem extends RecordInfo {
return false;
}
SchemaItem that = (SchemaItem) o;
return Objects.equal(id, that.id) && Objects.equal(name, that.name)
&& Objects.equal(bizName, that.bizName) && typeEnum == that.typeEnum;
return Objects.equals(id, that.id) && Objects.equals(name, that.name)
&& Objects.equals(bizName, that.bizName) && typeEnum == that.typeEnum;
}
@Override
public int hashCode() {
return Objects.hashCode(id, name, bizName, typeEnum);
return Objects.hash(id, name, bizName, typeEnum);
}
public static List<String> getAliasList(String alias) {

View File

@@ -53,4 +53,15 @@ public class DimensionResp extends SchemaItem {
public boolean isPartitionTime() {
return DimensionType.isPartitionTime(type);
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -10,10 +10,7 @@ import lombok.ToString;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Data
@@ -118,4 +115,15 @@ public class MetricResp extends SchemaItem {
public boolean isDerived() {
return MetricType.isDerived(metricDefineType, metricDefineByMeasureParams);
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -34,7 +34,8 @@ public class PromptHelper {
public List<List<Text2SQLExemplar>> getFewShotExemplars(LLMReq llmReq) {
int exemplarRecallNumber =
Integer.parseInt(parserConfig.getParameterValue(PARSER_EXEMPLAR_RECALL_NUMBER));
int fewShotNumber = Integer.parseInt(parserConfig.getParameterValue(PARSER_FEW_SHOT_NUMBER));
int fewShotNumber =
Integer.parseInt(parserConfig.getParameterValue(PARSER_FEW_SHOT_NUMBER));
int selfConsistencyNumber =
Integer.parseInt(parserConfig.getParameterValue(PARSER_SELF_CONSISTENCY_NUMBER));
@@ -103,7 +104,8 @@ public class PromptHelper {
metricStr.append(" COMMENT '").append(metric.getDescription()).append("'");
}
if (StringUtils.isNotEmpty(metric.getDefaultAgg())) {
metricStr.append(" AGGREGATE '").append(metric.getDefaultAgg().toUpperCase()).append("'");
metricStr.append(" AGGREGATE '").append(metric.getDefaultAgg().toUpperCase())
.append("'");
}
metricStr.append(">");
metrics.add(metricStr.toString());