mirror of https://github.com/milvus-io/milvus.git
parent
e8e21a0308
commit
8ae573b580
|
@ -28,5 +28,4 @@ proxy:
|
||||||
bufSize: 512
|
bufSize: 512
|
||||||
|
|
||||||
maxNameLength: 255
|
maxNameLength: 255
|
||||||
maxFieldNum: 64
|
maxFieldNum: 64
|
||||||
maxDimension: 32768
|
|
|
@ -189,10 +189,7 @@ func (sa *SegIDAssigner) syncSegments() {
|
||||||
for _, info := range resp.PerChannelAssignment {
|
for _, info := range resp.PerChannelAssignment {
|
||||||
assign := sa.getAssign(info.CollName, info.PartitionTag, info.ChannelID)
|
assign := sa.getAssign(info.CollName, info.PartitionTag, info.ChannelID)
|
||||||
if assign == nil {
|
if assign == nil {
|
||||||
colInfos, ok := sa.assignInfos[info.CollName]
|
colInfos := sa.assignInfos[info.CollName]
|
||||||
if !ok {
|
|
||||||
colInfos = list.New()
|
|
||||||
}
|
|
||||||
segInfo := make(map[UniqueID]uint32)
|
segInfo := make(map[UniqueID]uint32)
|
||||||
segInfo[info.SegID] = info.Count
|
segInfo[info.SegID] = info.Count
|
||||||
newAssign := &assignInfo{
|
newAssign := &assignInfo{
|
||||||
|
|
|
@ -192,11 +192,10 @@ ExecExprVisitor::visit(RangeExpr& expr) {
|
||||||
Assert(expr.data_type_ == field_meta.get_data_type());
|
Assert(expr.data_type_ == field_meta.get_data_type());
|
||||||
RetType ret;
|
RetType ret;
|
||||||
switch (expr.data_type_) {
|
switch (expr.data_type_) {
|
||||||
// case DataType::BOOL: {
|
case DataType::BOOL: {
|
||||||
// ret = ExecRangeVisitorDispatcher<bool>(expr);
|
ret = ExecRangeVisitorDispatcher<bool>(expr);
|
||||||
// break;
|
break;
|
||||||
//}
|
}
|
||||||
// case DataType::BOOL:
|
|
||||||
case DataType::INT8: {
|
case DataType::INT8: {
|
||||||
ret = ExecRangeVisitorDispatcher<int8_t>(expr);
|
ret = ExecRangeVisitorDispatcher<int8_t>(expr);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "utils/EasyAssert.h"
|
#include "utils/EasyAssert.h"
|
||||||
|
#include <boost/container/vector.hpp>
|
||||||
|
|
||||||
namespace milvus::segcore {
|
namespace milvus::segcore {
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ namespace milvus::segcore {
|
||||||
//};
|
//};
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
using FixedVector = std::vector<Type>;
|
using FixedVector = boost::container::vector<Type>;
|
||||||
constexpr int64_t DefaultElementPerChunk = 32 * 1024;
|
constexpr int64_t DefaultElementPerChunk = 32 * 1024;
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
|
|
|
@ -480,18 +480,6 @@ func (pt *ParamTable) MaxFieldNum() int64 {
|
||||||
return maxFieldNum
|
return maxFieldNum
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pt *ParamTable) MaxDimension() int64 {
|
|
||||||
str, err := pt.Load("proxy.maxDimension")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
maxDimension, err := strconv.ParseInt(str, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return maxDimension
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pt *ParamTable) defaultPartitionTag() string {
|
func (pt *ParamTable) defaultPartitionTag() string {
|
||||||
tag, err := pt.Load("common.defaultPartitionTag")
|
tag, err := pt.Load("common.defaultPartitionTag")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -181,33 +181,6 @@ func (cct *CreateCollectionTask) PreExecute() error {
|
||||||
if err := ValidateFieldName(field.Name); err != nil {
|
if err := ValidateFieldName(field.Name); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if field.DataType == schemapb.DataType_VECTOR_FLOAT || field.DataType == schemapb.DataType_VECTOR_BINARY {
|
|
||||||
exist := false
|
|
||||||
var dim int64 = 0
|
|
||||||
for _, param := range field.TypeParams {
|
|
||||||
if param.Key == "dim" {
|
|
||||||
exist = true
|
|
||||||
tmp, err := strconv.ParseInt(param.Value, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dim = tmp
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !exist {
|
|
||||||
return errors.New("dimension is not defined in field type params")
|
|
||||||
}
|
|
||||||
if field.DataType == schemapb.DataType_VECTOR_FLOAT {
|
|
||||||
if err := ValidateDimension(dim, false); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := ValidateDimension(dim, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -116,14 +116,3 @@ func ValidateFieldName(fieldName string) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateDimension(dim int64, isBinary bool) error {
|
|
||||||
if dim <= 0 || dim > Params.MaxDimension() {
|
|
||||||
return errors.New("invalid dimension: " + strconv.FormatInt(dim, 10) + ". should be in range 1 ~ " +
|
|
||||||
strconv.FormatInt(Params.MaxDimension(), 10) + ".")
|
|
||||||
}
|
|
||||||
if isBinary && dim%8 != 0 {
|
|
||||||
return errors.New("invalid dimension: " + strconv.FormatInt(dim, 10) + ". should be multiple of 8.")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -82,16 +82,3 @@ func TestValidateFieldName(t *testing.T) {
|
||||||
assert.NotNil(t, ValidateFieldName(name))
|
assert.NotNil(t, ValidateFieldName(name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDimension(t *testing.T) {
|
|
||||||
Params.Init()
|
|
||||||
assert.Nil(t, ValidateDimension(1, false))
|
|
||||||
assert.Nil(t, ValidateDimension(Params.MaxDimension(), false))
|
|
||||||
assert.Nil(t, ValidateDimension(8, true))
|
|
||||||
assert.Nil(t, ValidateDimension(Params.MaxDimension(), true))
|
|
||||||
|
|
||||||
// invalid dim
|
|
||||||
assert.NotNil(t, ValidateDimension(-1, false))
|
|
||||||
assert.NotNil(t, ValidateDimension(Params.MaxDimension()+1, false))
|
|
||||||
assert.NotNil(t, ValidateDimension(9, true))
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue