mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
Fix bool type
Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
This commit is contained in:
parent
6bd5702441
commit
89f38e459a
@ -13,11 +13,12 @@
|
||||
#include "Expr.h"
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <boost/container/vector.hpp>
|
||||
|
||||
namespace milvus::query {
|
||||
template <typename T>
|
||||
struct TermExprImpl : TermExpr {
|
||||
std::vector<T> terms_;
|
||||
boost::container::vector<T> terms_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -115,6 +115,8 @@ ShowExprVisitor::visit(TermExpr& expr) {
|
||||
Assert(field_is_vector(expr.data_type_) == false);
|
||||
auto terms = [&] {
|
||||
switch (expr.data_type_) {
|
||||
case DataType::BOOL:
|
||||
return TermExtract<bool>(expr);
|
||||
case DataType::INT8:
|
||||
return TermExtract<int8_t>(expr);
|
||||
case DataType::INT16:
|
||||
|
@ -25,33 +25,6 @@
|
||||
|
||||
namespace milvus::segcore {
|
||||
|
||||
// we don't use std::array because capacity of concurrent_vector wastes too much memory
|
||||
// template <typename Type>
|
||||
// class FixedVector : public std::vector<Type> {
|
||||
// public:
|
||||
// // This is a stupid workaround for tbb API to avoid memory copy
|
||||
// explicit FixedVector(int64_t size) : placeholder_size_(size) {
|
||||
// }
|
||||
// FixedVector(const FixedVector<Type>& placeholder_vec)
|
||||
// : std::vector<Type>(placeholder_vec.placeholder_size_), is_placeholder_(false) {
|
||||
// // Assert(placeholder_vec.is_placeholder_);
|
||||
// }
|
||||
// FixedVector(FixedVector<Type>&&) = delete;
|
||||
//
|
||||
// FixedVector&
|
||||
// operator=(FixedVector<Type>&&) = delete;
|
||||
//
|
||||
// FixedVector&
|
||||
// operator=(const FixedVector<Type>&) = delete;
|
||||
//
|
||||
// bool is_placeholder() {
|
||||
// return is_placeholder_;
|
||||
// }
|
||||
// private:
|
||||
// bool is_placeholder_ = true;
|
||||
// int placeholder_size_ = 0;
|
||||
//};
|
||||
|
||||
template <typename Type>
|
||||
using FixedVector = boost::container::vector<Type>;
|
||||
|
||||
|
@ -111,6 +111,8 @@ CreateIndex(const FieldMeta& field_meta, int64_t chunk_size) {
|
||||
}
|
||||
}
|
||||
switch (field_meta.get_data_type()) {
|
||||
case DataType::BOOL:
|
||||
return std::make_unique<ScalarIndexingEntry<bool>>(field_meta, chunk_size);
|
||||
case DataType::INT8:
|
||||
return std::make_unique<ScalarIndexingEntry<int8_t>>(field_meta, chunk_size);
|
||||
case DataType::INT16:
|
||||
|
@ -27,6 +27,10 @@ InsertRecord::InsertRecord(const Schema& schema, int64_t chunk_size) : uids_(1),
|
||||
}
|
||||
}
|
||||
switch (field.get_data_type()) {
|
||||
case DataType::BOOL: {
|
||||
entity_vec_.emplace_back(std::make_shared<ConcurrentVector<bool>>(chunk_size));
|
||||
break;
|
||||
}
|
||||
case DataType::INT8: {
|
||||
entity_vec_.emplace_back(std::make_shared<ConcurrentVector<int8_t>>(chunk_size));
|
||||
break;
|
||||
|
@ -21,7 +21,6 @@ type ParamTable struct {
|
||||
KvRootPath string
|
||||
WriteNodeSegKvSubPath string
|
||||
PulsarAddress string
|
||||
IndexBuilderAddress string
|
||||
|
||||
// nodeID
|
||||
ProxyIDList []typeutil.UniqueID
|
||||
@ -72,7 +71,6 @@ func (p *ParamTable) Init() {
|
||||
p.initKvRootPath()
|
||||
p.initWriteNodeSegKvSubPath()
|
||||
p.initPulsarAddress()
|
||||
p.initIndexBuilderAddress()
|
||||
|
||||
p.initProxyIDList()
|
||||
p.initWriteNodeIDList()
|
||||
@ -127,14 +125,6 @@ func (p *ParamTable) initPulsarAddress() {
|
||||
p.PulsarAddress = addr
|
||||
}
|
||||
|
||||
func (p *ParamTable) initIndexBuilderAddress() {
|
||||
ret, err := p.Load("_IndexBuilderAddress")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
p.IndexBuilderAddress = ret
|
||||
}
|
||||
|
||||
func (p *ParamTable) initMetaRootPath() {
|
||||
rootPath, err := p.Load("etcd.rootPath")
|
||||
if err != nil {
|
||||
|
@ -31,11 +31,6 @@ func TestParamTable_KVRootPath(t *testing.T) {
|
||||
assert.Equal(t, path, "by-dev/kv")
|
||||
}
|
||||
|
||||
func TestParamTable_IndexBuilderAddress(t *testing.T) {
|
||||
path := Params.IndexBuilderAddress
|
||||
assert.Equal(t, path, "localhost:31000")
|
||||
}
|
||||
|
||||
func TestParamTable_TopicNum(t *testing.T) {
|
||||
num := Params.TopicNum
|
||||
fmt.Println("TopicNum:", num)
|
||||
|
@ -57,40 +57,19 @@ func (gp *BaseTable) Init() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
gp.tryloadFromEnv()
|
||||
|
||||
}
|
||||
|
||||
func (gp *BaseTable) tryloadFromEnv() {
|
||||
|
||||
minioAddress := os.Getenv("MINIO_ADDRESS")
|
||||
if minioAddress == "" {
|
||||
minioHost, err := gp.Load("minio.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
port, err := gp.Load("minio.port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
minioAddress = minioHost + ":" + port
|
||||
minioAddress = "localhost:9000"
|
||||
}
|
||||
err := gp.Save("_MinioAddress", minioAddress)
|
||||
err = gp.Save("_MinioAddress", minioAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
etcdAddress := os.Getenv("ETCD_ADDRESS")
|
||||
if etcdAddress == "" {
|
||||
etcdHost, err := gp.Load("etcd.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
port, err := gp.Load("etcd.port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
etcdAddress = etcdHost + ":" + port
|
||||
etcdAddress = "localhost:2379"
|
||||
}
|
||||
err = gp.Save("_EtcdAddress", etcdAddress)
|
||||
if err != nil {
|
||||
@ -99,15 +78,7 @@ func (gp *BaseTable) tryloadFromEnv() {
|
||||
|
||||
pulsarAddress := os.Getenv("PULSAR_ADDRESS")
|
||||
if pulsarAddress == "" {
|
||||
pulsarHost, err := gp.Load("pulsar.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
port, err := gp.Load("pulsar.port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
pulsarAddress = "pulsar://" + pulsarHost + ":" + port
|
||||
pulsarAddress = "pulsar://localhost:6650"
|
||||
}
|
||||
err = gp.Save("_PulsarAddress", pulsarAddress)
|
||||
if err != nil {
|
||||
@ -116,37 +87,12 @@ func (gp *BaseTable) tryloadFromEnv() {
|
||||
|
||||
masterAddress := os.Getenv("MASTER_ADDRESS")
|
||||
if masterAddress == "" {
|
||||
masterHost, err := gp.Load("master.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
port, err := gp.Load("master.port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
masterAddress = masterHost + ":" + port
|
||||
masterAddress = "localhost:53100"
|
||||
}
|
||||
err = gp.Save("_MasterAddress", masterAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
indexBuilderAddress := os.Getenv("INDEX_BUILDER_ADDRESS")
|
||||
if indexBuilderAddress == "" {
|
||||
indexBuilderHost, err := gp.Load("indexBuilder.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
port, err := gp.Load("indexBuilder.port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
indexBuilderAddress = indexBuilderHost + ":" + port
|
||||
}
|
||||
err = gp.Save("_IndexBuilderAddress", indexBuilderAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (gp *BaseTable) Load(key string) (string, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user