Skip to content

Commit

Permalink
add row type
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPresent-Han committed Oct 12, 2024
1 parent ef0c649 commit 91e27a7
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 9 deletions.
11 changes: 11 additions & 0 deletions internal/core/src/common/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,4 +682,15 @@ struct fmt::formatter<milvus::OpType> : formatter<string_view> {
}
return formatter<string_view>::format(name, ctx);
}
};

class RowType final {
public:
RowType(std::vector<std::string>&& names, std::vector<milvus::DataType>&& types):
names_(std::move(names)), columns_types_(std::move(types)){}

private:
const std::vector<std::string> names_;
const std::vector<milvus::DataType> columns_types_;

};
2 changes: 1 addition & 1 deletion internal/core/src/exec/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ DriverFactory::CreateDriver(std::unique_ptr<DriverContext> ctx,
operators.push_back(std::make_unique<PhyVectorSearchNode>(
id, ctx.get(), vectorsearchnode));
} else if (auto groupbynode =
std::dynamic_pointer_cast<const plan::GroupByNode>(
std::dynamic_pointer_cast<const plan::VectorGroupByNode>(
plannode)) {
operators.push_back(
std::make_unique<PhyGroupByNode>(id, ctx.get(), groupbynode));
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/exec/operator/GroupByNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace exec {
PhyGroupByNode::PhyGroupByNode(
int32_t operator_id,
DriverContext* driverctx,
const std::shared_ptr<const plan::GroupByNode>& node)
const std::shared_ptr<const plan::VectorGroupByNode>& node)
: Operator(driverctx, node->output_type(), operator_id, node->id()) {
ExecContext* exec_context = operator_context_->get_exec_context();
query_context_ = exec_context->get_query_context();
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/exec/operator/GroupByNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PhyGroupByNode : public Operator {
public:
PhyGroupByNode(int32_t operator_id,
DriverContext* ctx,
const std::shared_ptr<const plan::GroupByNode>& node);
const std::shared_ptr<const plan::VectorGroupByNode>& node);

bool
IsFilter() override {
Expand Down
40 changes: 35 additions & 5 deletions internal/core/src/plan/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ class VectorSearchNode : public PlanNode {
const std::vector<PlanNodePtr> sources_;
};

class GroupByNode : public PlanNode {
class VectorGroupByNode : public PlanNode {
public:
GroupByNode(const PlanNodeId& id,
std::vector<PlanNodePtr> sources = std::vector<PlanNodePtr>{})
VectorGroupByNode(const PlanNodeId& id,
std::vector<PlanNodePtr> sources = std::vector<PlanNodePtr>{})
: PlanNode(id), sources_{std::move(sources)} {
}

Expand All @@ -353,12 +353,12 @@ class GroupByNode : public PlanNode {

std::string_view
name() const override {
return "GroupByNode";
return "VectorGroupByNode";
}

std::string
ToString() const override {
return fmt::format("GroupByNode:\n\t[source node:{}]",
return fmt::format("VectorGroupByNode:\n\t[source node:{}]",
SourceToString());
}

Expand Down Expand Up @@ -399,6 +399,36 @@ class CountNode : public PlanNode {
const std::vector<PlanNodePtr> sources_;
};

class AggregationNode: public PlanNode {
public:
enum class Step {
// raw input in - partial result out
kPartial,
// partial result in - final result out
kFinal,
// partial result in - partial result out
kIntermediate,
// raw input in - final result out
kSingle
};

struct Aggregate {
/// Function name and input column names.
expr::CallTypeExprPtr call;

/// Raw input types used to properly identify aggregate function. These
/// might be different from the input types specified in 'call' when
/// aggregation step is kIntermediate or kFinal.
std::vector<DataType> rawInputTypes;
};
private:
const std::vector<expr::FieldAccessTypeExprPtr> groupingKeys_;
const std::vector<std::string> aggregateNames_;
const bool ignoreNullKeys_;
const std::vector<PlanNodePtr> sources_;
//const RowType
};

enum class ExecutionStrategy {
// Process splits as they come in any available driver.
kUngrouped,
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/query/PlanProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ProtoParser::PlanNodeFromProto(const planpb::PlanNode& plan_node_proto) {
sources = std::vector<milvus::plan::PlanNodePtr>{plannode};

if (plan_node->search_info_.group_by_field_id_ != std::nullopt) {
plannode = std::make_shared<milvus::plan::GroupByNode>(
plannode = std::make_shared<milvus::plan::VectorGroupByNode>(
milvus::plan::GetNextPlanNodeId(), sources);
sources = std::vector<milvus::plan::PlanNodePtr>{plannode};
}
Expand Down
164 changes: 164 additions & 0 deletions internal/core/virtualenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
digraph {
"google-cloud-cpp/2.5.0@milvus/dev" -> "protobuf/3.21.4"
"google-cloud-cpp/2.5.0@milvus/dev" -> "grpc/1.50.1"
"google-cloud-cpp/2.5.0@milvus/dev" -> "nlohmann_json/3.11.2"
"google-cloud-cpp/2.5.0@milvus/dev" -> "crc32c/1.1.1"
"google-cloud-cpp/2.5.0@milvus/dev" -> "abseil/20230125.3"
"google-cloud-cpp/2.5.0@milvus/dev" -> "libcurl/7.86.0"
"google-cloud-cpp/2.5.0@milvus/dev" -> "openssl/3.1.2"
"google-cloud-cpp/2.5.0@milvus/dev" -> "zlib/1.2.13"
"google-cloud-cpp/2.5.0@milvus/dev" -> "googleapis/cci.20221108"
"aws-c-compression/0.2.15" -> "aws-c-common/0.8.2"
"aws-c-s3/0.1.37" -> "aws-c-common/0.8.2"
"aws-c-s3/0.1.37" -> "aws-c-cal/0.5.13"
"aws-c-s3/0.1.37" -> "aws-c-auth/0.6.11"
"aws-c-s3/0.1.37" -> "aws-c-http/0.6.13"
"aws-c-s3/0.1.37" -> "aws-c-io/0.10.20"
"aws-c-s3/0.1.37" -> "aws-checksums/0.1.13"
"aws-c-cal/0.5.13" -> "aws-c-common/0.8.2"
"aws-c-cal/0.5.13" -> "openssl/3.1.2"
"s2n/1.3.55" -> "openssl/3.1.2"
"aws-c-event-stream/0.2.7" -> "aws-c-common/0.8.2"
"aws-c-event-stream/0.2.7" -> "aws-checksums/0.1.13"
"aws-c-event-stream/0.2.7" -> "aws-c-io/0.10.20"
"aws-c-auth/0.6.11" -> "aws-c-common/0.8.2"
"aws-c-auth/0.6.11" -> "aws-c-cal/0.5.13"
"aws-c-auth/0.6.11" -> "aws-c-io/0.10.20"
"aws-c-auth/0.6.11" -> "aws-c-http/0.6.13"
"aws-c-auth/0.6.11" -> "aws-c-sdkutils/0.1.3"
"librdkafka/1.9.1" -> "lz4/1.9.4"
"librdkafka/1.9.1" -> "zstd/1.5.4"
"librdkafka/1.9.1" -> "openssl/3.1.2"
"librdkafka/1.9.1" -> "cyrus-sasl/2.1.27"
"openssl/3.1.2" -> "zlib/1.2.13"
"glog/0.6.0" -> "gflags/2.2.2"
"glog/0.6.0" -> "libunwind/1.7.2"
"onetbb/2021.9.0" -> "hwloc/2.9.3"
"aws-c-http/0.6.13" -> "aws-c-compression/0.2.15"
"aws-c-http/0.6.13" -> "aws-c-common/0.8.2"
"aws-c-http/0.6.13" -> "aws-c-io/0.10.20"
"libunwind/1.7.2" -> "xz_utils/5.4.0"
"libunwind/1.7.2" -> "zlib/1.2.13"
"aws-c-mqtt/0.7.10" -> "aws-c-common/0.8.2"
"aws-c-mqtt/0.7.10" -> "aws-c-cal/0.5.13"
"aws-c-mqtt/0.7.10" -> "aws-c-io/0.10.20"
"aws-c-mqtt/0.7.10" -> "aws-c-http/0.6.13"
"libcurl/7.86.0" -> "openssl/3.1.2"
"libcurl/7.86.0" -> "zlib/1.2.13"
"arrow/12.0.1" -> "thrift/0.17.0"
"arrow/12.0.1" -> "jemalloc/5.3.0"
"arrow/12.0.1" -> "boost/1.82.0"
"arrow/12.0.1" -> "aws-sdk-cpp/1.9.234"
"arrow/12.0.1" -> "xsimd/9.0.1"
"arrow/12.0.1" -> "zstd/1.5.4"
"arrow/12.0.1" -> "re2/20230301"
"cyrus-sasl/2.1.27" -> "openssl/3.1.2"
"libevent/2.1.12" -> "openssl/3.1.2"
"aws-checksums/0.1.13" -> "aws-c-common/0.8.2"
"grpc/1.50.1" -> "abseil/20230125.3"
"grpc/1.50.1" -> "c-ares/1.19.1"
"grpc/1.50.1" -> "openssl/3.1.2"
"grpc/1.50.1" -> "protobuf/3.21.4"
"grpc/1.50.1" -> "re2/20230301"
"grpc/1.50.1" -> "zlib/1.2.13"
"googleapis/cci.20221108" -> "protobuf/3.21.4"
"prometheus-cpp/1.1.0" -> "libcurl/7.86.0"
"rocksdb/6.29.5@milvus/dev" -> "zstd/1.5.4"
"folly/2023.10.30.08@milvus/dev" -> "boost/1.82.0"
"folly/2023.10.30.08@milvus/dev" -> "bzip2/1.0.8"
"folly/2023.10.30.08@milvus/dev" -> "double-conversion/3.2.1"
"folly/2023.10.30.08@milvus/dev" -> "gflags/2.2.2"
"folly/2023.10.30.08@milvus/dev" -> "glog/0.6.0"
"folly/2023.10.30.08@milvus/dev" -> "libevent/2.1.12"
"folly/2023.10.30.08@milvus/dev" -> "openssl/3.1.2"
"folly/2023.10.30.08@milvus/dev" -> "lz4/1.9.4"
"folly/2023.10.30.08@milvus/dev" -> "snappy/1.1.9"
"folly/2023.10.30.08@milvus/dev" -> "zlib/1.2.13"
"folly/2023.10.30.08@milvus/dev" -> "zstd/1.5.4"
"folly/2023.10.30.08@milvus/dev" -> "libdwarf/20191104"
"folly/2023.10.30.08@milvus/dev" -> "libsodium/cci.20220430"
"folly/2023.10.30.08@milvus/dev" -> "xz_utils/5.4.0"
"folly/2023.10.30.08@milvus/dev" -> "libiberty/9.1.0"
"folly/2023.10.30.08@milvus/dev" -> "libunwind/1.7.2"
"folly/2023.10.30.08@milvus/dev" -> "fmt/9.1.0"
"aws-c-io/0.10.20" -> "aws-c-common/0.8.2"
"aws-c-io/0.10.20" -> "aws-c-cal/0.5.13"
"aws-c-io/0.10.20" -> "s2n/1.3.55"
"aws-sdk-cpp/1.9.234" -> "aws-c-common/0.8.2"
"aws-sdk-cpp/1.9.234" -> "aws-c-event-stream/0.2.7"
"aws-sdk-cpp/1.9.234" -> "aws-checksums/0.1.13"
"aws-sdk-cpp/1.9.234" -> "aws-c-cal/0.5.13"
"aws-sdk-cpp/1.9.234" -> "aws-c-http/0.6.13"
"aws-sdk-cpp/1.9.234" -> "aws-c-io/0.10.20"
"aws-sdk-cpp/1.9.234" -> "aws-crt-cpp/0.17.23"
"aws-sdk-cpp/1.9.234" -> "openssl/3.1.2"
"aws-sdk-cpp/1.9.234" -> "libcurl/7.86.0"
"thrift/0.17.0" -> "boost/1.82.0"
"thrift/0.17.0" -> "openssl/3.1.2"
"thrift/0.17.0" -> "zlib/1.2.13"
"thrift/0.17.0" -> "libevent/2.1.12"
"libdwarf/20191104" -> "libelf/0.8.13"
"libdwarf/20191104" -> "zlib/1.2.13"
"conanfile.py" -> "rocksdb/6.29.5@milvus/dev"
"conanfile.py" -> "boost/1.82.0"
"conanfile.py" -> "onetbb/2021.9.0"
"conanfile.py" -> "nlohmann_json/3.11.2"
"conanfile.py" -> "zstd/1.5.4"
"conanfile.py" -> "lz4/1.9.4"
"conanfile.py" -> "snappy/1.1.9"
"conanfile.py" -> "lzo/2.10"
"conanfile.py" -> "arrow/12.0.1"
"conanfile.py" -> "openssl/3.1.2"
"conanfile.py" -> "aws-sdk-cpp/1.9.234"
"conanfile.py" -> "googleapis/cci.20221108"
"conanfile.py" -> "benchmark/1.7.0"
"conanfile.py" -> "gtest/1.13.0"
"conanfile.py" -> "protobuf/3.21.4"
"conanfile.py" -> "rapidxml/1.13"
"conanfile.py" -> "yaml-cpp/0.7.0"
"conanfile.py" -> "marisa/0.2.6"
"conanfile.py" -> "zlib/1.2.13"
"conanfile.py" -> "libcurl/7.86.0"
"conanfile.py" -> "glog/0.6.0"
"conanfile.py" -> "fmt/9.1.0"
"conanfile.py" -> "gflags/2.2.2"
"conanfile.py" -> "double-conversion/3.2.1"
"conanfile.py" -> "libevent/2.1.12"
"conanfile.py" -> "libdwarf/20191104"
"conanfile.py" -> "libiberty/9.1.0"
"conanfile.py" -> "libsodium/cci.20220430"
"conanfile.py" -> "xsimd/9.0.1"
"conanfile.py" -> "xz_utils/5.4.0"
"conanfile.py" -> "prometheus-cpp/1.1.0"
"conanfile.py" -> "re2/20230301"
"conanfile.py" -> "folly/2023.10.30.08@milvus/dev"
"conanfile.py" -> "google-cloud-cpp/2.5.0@milvus/dev"
"conanfile.py" -> "opentelemetry-cpp/1.8.1.1@milvus/dev"
"conanfile.py" -> "librdkafka/1.9.1"
"conanfile.py" -> "abseil/20230125.3"
"conanfile.py" -> "roaring/3.0.0"
"conanfile.py" -> "libunwind/1.7.2"
"aws-crt-cpp/0.17.23" -> "aws-c-cal/0.5.13"
"aws-crt-cpp/0.17.23" -> "aws-c-common/0.8.2"
"aws-crt-cpp/0.17.23" -> "aws-checksums/0.1.13"
"aws-crt-cpp/0.17.23" -> "aws-c-auth/0.6.11"
"aws-crt-cpp/0.17.23" -> "aws-c-event-stream/0.2.7"
"aws-crt-cpp/0.17.23" -> "aws-c-http/0.6.13"
"aws-crt-cpp/0.17.23" -> "aws-c-io/0.10.20"
"aws-crt-cpp/0.17.23" -> "aws-c-mqtt/0.7.10"
"aws-crt-cpp/0.17.23" -> "aws-c-s3/0.1.37"
"aws-c-sdkutils/0.1.3" -> "aws-c-common/0.8.2"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "abseil/20230125.3"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "protobuf/3.21.4"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "opentelemetry-proto/0.19.0"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "grpc/1.50.1"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "nlohmann_json/3.11.2"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "openssl/3.1.2"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "libcurl/7.86.0"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "thrift/0.17.0"
"opentelemetry-cpp/1.8.1.1@milvus/dev" -> "boost/1.82.0"
"boost/1.82.0" -> "zlib/1.2.13"
"boost/1.82.0" -> "bzip2/1.0.8"
"boost/1.82.0" -> "libbacktrace/cci.20210118"
"protobuf/3.21.4" -> "zlib/1.2.13"
}

0 comments on commit 91e27a7

Please sign in to comment.