Fix bool bug

Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
pull/4973/head^2
FluorineDog 2020-11-26 14:56:58 +08:00 committed by yefu.chen
parent e8e21a0308
commit 8ae573b580
8 changed files with 8 additions and 75 deletions

View File

@ -28,5 +28,4 @@ proxy:
bufSize: 512
maxNameLength: 255
maxFieldNum: 64
maxDimension: 32768
maxFieldNum: 64

View File

@ -189,10 +189,7 @@ func (sa *SegIDAssigner) syncSegments() {
for _, info := range resp.PerChannelAssignment {
assign := sa.getAssign(info.CollName, info.PartitionTag, info.ChannelID)
if assign == nil {
colInfos, ok := sa.assignInfos[info.CollName]
if !ok {
colInfos = list.New()
}
colInfos := sa.assignInfos[info.CollName]
segInfo := make(map[UniqueID]uint32)
segInfo[info.SegID] = info.Count
newAssign := &assignInfo{

View File

@ -192,11 +192,10 @@ ExecExprVisitor::visit(RangeExpr& expr) {
Assert(expr.data_type_ == field_meta.get_data_type());
RetType ret;
switch (expr.data_type_) {
// case DataType::BOOL: {
// ret = ExecRangeVisitorDispatcher<bool>(expr);
// break;
//}
// case DataType::BOOL:
case DataType::BOOL: {
ret = ExecRangeVisitorDispatcher<bool>(expr);
break;
}
case DataType::INT8: {
ret = ExecRangeVisitorDispatcher<int8_t>(expr);
break;

View File

@ -20,6 +20,7 @@
#include <vector>
#include <utility>
#include "utils/EasyAssert.h"
#include <boost/container/vector.hpp>
namespace milvus::segcore {
@ -51,7 +52,7 @@ namespace milvus::segcore {
//};
template <typename Type>
using FixedVector = std::vector<Type>;
using FixedVector = boost::container::vector<Type>;
constexpr int64_t DefaultElementPerChunk = 32 * 1024;
template <typename Type>

View File

@ -480,18 +480,6 @@ func (pt *ParamTable) MaxFieldNum() int64 {
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 {
tag, err := pt.Load("common.defaultPartitionTag")
if err != nil {

View File

@ -181,33 +181,6 @@ func (cct *CreateCollectionTask) PreExecute() error {
if err := ValidateFieldName(field.Name); err != nil {
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

View File

@ -116,14 +116,3 @@ func ValidateFieldName(fieldName string) error {
}
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
}

View File

@ -82,16 +82,3 @@ func TestValidateFieldName(t *testing.T) {
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))
}