mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
enhance: Rectify run_clang_format grep command (#39534)
Previously the grep with regex does not work and failed to match lots of .cpp files This PR: - use "-E" flag to use regex match - commit the fixed result of current cpp code Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
56659bacbb
commit
844df76cc0
@ -9,7 +9,7 @@ CorePath=$1
|
|||||||
CLANG_FORMAT=clang-format-12
|
CLANG_FORMAT=clang-format-12
|
||||||
|
|
||||||
formatThis() {
|
formatThis() {
|
||||||
find "$1" | grep "(\.cpp\|\.h\|\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs $CLANG_FORMAT -i
|
find "$1" | grep -E "(\.cpp|\.h|\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs $CLANG_FORMAT -i
|
||||||
}
|
}
|
||||||
|
|
||||||
formatThis "${CorePath}/src"
|
formatThis "${CorePath}/src"
|
||||||
|
|||||||
@ -37,13 +37,16 @@ CheckBruteForceSearchParam(const FieldMeta& field,
|
|||||||
"[BruteForceSearch] Data type isn't vector type");
|
"[BruteForceSearch] Data type isn't vector type");
|
||||||
if (IsBinaryVectorDataType(data_type)) {
|
if (IsBinaryVectorDataType(data_type)) {
|
||||||
AssertInfo(IsBinaryVectorMetricType(metric_type),
|
AssertInfo(IsBinaryVectorMetricType(metric_type),
|
||||||
"[BruteForceSearch] Binary vector, data type and metric type miss-match");
|
"[BruteForceSearch] Binary vector, data type and metric "
|
||||||
|
"type miss-match");
|
||||||
} else if (IsFloatVectorDataType(data_type)) {
|
} else if (IsFloatVectorDataType(data_type)) {
|
||||||
AssertInfo(IsFloatVectorMetricType(metric_type),
|
AssertInfo(IsFloatVectorMetricType(metric_type),
|
||||||
"[BruteForceSearch] Float vector, data type and metric type miss-match");
|
"[BruteForceSearch] Float vector, data type and metric type "
|
||||||
|
"miss-match");
|
||||||
} else if (IsIntVectorDataType(data_type)) {
|
} else if (IsIntVectorDataType(data_type)) {
|
||||||
AssertInfo(IsIntVectorMetricType(metric_type),
|
AssertInfo(IsIntVectorMetricType(metric_type),
|
||||||
"[BruteForceSearch] Int vector, data type and metric type miss-match");
|
"[BruteForceSearch] Int vector, data type and metric type "
|
||||||
|
"miss-match");
|
||||||
} else {
|
} else {
|
||||||
AssertInfo(IsVectorDataType(data_type),
|
AssertInfo(IsVectorDataType(data_type),
|
||||||
"[BruteForceSearch] Unsupported vector data type");
|
"[BruteForceSearch] Unsupported vector data type");
|
||||||
@ -165,7 +168,7 @@ BruteForceSearch(const dataset::SearchDataset& query_ds,
|
|||||||
} else if (data_type == DataType::VECTOR_INT8) {
|
} else if (data_type == DataType::VECTOR_INT8) {
|
||||||
// TODO caiyd: if knowhere support real int8 bf, change it
|
// TODO caiyd: if knowhere support real int8 bf, change it
|
||||||
res = knowhere::BruteForce::RangeSearch<float>(
|
res = knowhere::BruteForce::RangeSearch<float>(
|
||||||
base_dataset, query_dataset, search_cfg, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
ErrorCode::Unsupported,
|
ErrorCode::Unsupported,
|
||||||
@ -279,7 +282,7 @@ DispatchBruteForceIteratorByDataType(const knowhere::DataSetPtr& base_dataset,
|
|||||||
case DataType::VECTOR_INT8:
|
case DataType::VECTOR_INT8:
|
||||||
// TODO caiyd: if knowhere support real int8 bf, change it
|
// TODO caiyd: if knowhere support real int8 bf, change it
|
||||||
return knowhere::BruteForce::AnnIterator<float>(
|
return knowhere::BruteForce::AnnIterator<float>(
|
||||||
base_dataset, query_dataset, config, bitset);
|
base_dataset, query_dataset, config, bitset);
|
||||||
default:
|
default:
|
||||||
PanicInfo(ErrorCode::Unsupported,
|
PanicInfo(ErrorCode::Unsupported,
|
||||||
"Unsupported dataType for chunk brute force iterator:{}",
|
"Unsupported dataType for chunk brute force iterator:{}",
|
||||||
|
|||||||
@ -169,11 +169,10 @@ class ConcurrentVectorImpl : public VectorBase {
|
|||||||
Float16Vector,
|
Float16Vector,
|
||||||
std::conditional_t<
|
std::conditional_t<
|
||||||
std::is_same_v<Type, bfloat16>,
|
std::is_same_v<Type, bfloat16>,
|
||||||
BFloat16Vector,
|
BFloat16Vector,
|
||||||
std::conditional_t<
|
std::conditional_t<std::is_same_v<Type, int8>,
|
||||||
std::is_same_v<Type, int8>,
|
Int8Vector,
|
||||||
Int8Vector,
|
BinaryVector>>>>>;
|
||||||
BinaryVector>>>>>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConcurrentVectorImpl(
|
explicit ConcurrentVectorImpl(
|
||||||
@ -546,8 +545,7 @@ class ConcurrentVector<BFloat16Vector>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class ConcurrentVector<Int8Vector>
|
class ConcurrentVector<Int8Vector> : public ConcurrentVectorImpl<int8, false> {
|
||||||
: public ConcurrentVectorImpl<int8, false> {
|
|
||||||
public:
|
public:
|
||||||
ConcurrentVector(int64_t dim,
|
ConcurrentVector(int64_t dim,
|
||||||
int64_t size_per_chunk,
|
int64_t size_per_chunk,
|
||||||
|
|||||||
@ -609,8 +609,7 @@ MergeDataArray(std::vector<MergeBase>& merge_bases,
|
|||||||
}
|
}
|
||||||
vector_array->set_dim(dst->dim());
|
vector_array->set_dim(dst->dim());
|
||||||
*dst->mutable_contents() = src.contents();
|
*dst->mutable_contents() = src.contents();
|
||||||
} else if (field_meta.get_data_type() ==
|
} else if (field_meta.get_data_type() == DataType::VECTOR_INT8) {
|
||||||
DataType::VECTOR_INT8) {
|
|
||||||
auto data = VEC_FIELD_DATA(src_field_data, int8);
|
auto data = VEC_FIELD_DATA(src_field_data, int8);
|
||||||
auto obj = vector_array->mutable_int8_vector();
|
auto obj = vector_array->mutable_int8_vector();
|
||||||
obj->assign(data, dim * sizeof(int8));
|
obj->assign(data, dim * sizeof(int8));
|
||||||
|
|||||||
@ -316,7 +316,7 @@ CreateArrowBuilder(DataType data_type, int dim) {
|
|||||||
case DataType::VECTOR_INT8: {
|
case DataType::VECTOR_INT8: {
|
||||||
AssertInfo(dim > 0, "invalid dim value");
|
AssertInfo(dim > 0, "invalid dim value");
|
||||||
return std::make_shared<arrow::FixedSizeBinaryBuilder>(
|
return std::make_shared<arrow::FixedSizeBinaryBuilder>(
|
||||||
arrow::fixed_size_binary(dim * sizeof(int8)));
|
arrow::fixed_size_binary(dim * sizeof(int8)));
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
@ -837,7 +837,7 @@ CreateFieldData(const DataType& type,
|
|||||||
type, total_num_rows);
|
type, total_num_rows);
|
||||||
case DataType::VECTOR_INT8:
|
case DataType::VECTOR_INT8:
|
||||||
return std::make_shared<FieldData<Int8Vector>>(
|
return std::make_shared<FieldData<Int8Vector>>(
|
||||||
dim, type, total_num_rows);
|
dim, type, total_num_rows);
|
||||||
default:
|
default:
|
||||||
PanicInfo(DataTypeInvalid,
|
PanicInfo(DataTypeInvalid,
|
||||||
"CreateFieldData not support data type " +
|
"CreateFieldData not support data type " +
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user