Skip to content

Commit

Permalink
change outputType to rowType ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPresent-Han committed Oct 21, 2024
1 parent c4c58aa commit 6ce1fd5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
9 changes: 7 additions & 2 deletions internal/core/src/common/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -684,14 +684,19 @@ struct fmt::formatter<milvus::OpType> : formatter<string_view> {
}
};


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

static const std::shared_ptr<const RowType> None;
private:
const std::vector<std::string> names_;
const std::vector<milvus::DataType> columns_types_;
};

using RowTypePtr = std::shared_ptr<const RowType>;
using RowTypePtr = std::shared_ptr<const RowType>;

const RowTypePtr RowType::None = std::make_shared<const RowType>(std::vector<std::string>{}, std::vector<milvus::DataType>{});

2 changes: 1 addition & 1 deletion internal/core/src/exec/operator/CallbackSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CallbackSink : public Operator {
int32_t operator_id,
DriverContext* ctx,
std::function<BlockingReason(RowVectorPtr, ContinueFuture*)> callback)
: Operator(ctx, DataType::NONE, operator_id, "N/A", "CallbackSink"),
: Operator(ctx, RowType::None, operator_id, "N/A", "CallbackSink"),
callback_(callback) {
}

Expand Down
11 changes: 8 additions & 3 deletions internal/core/src/exec/operator/Operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ class OperatorContext {
class Operator {
public:
Operator(DriverContext* ctx,
DataType output_type,
RowTypePtr output_type,
int32_t operator_id,
const std::string& plannode_id,
const std::string& operator_type = "")
: operator_context_(std::make_unique<OperatorContext>(
ctx, plannode_id, operator_id, operator_type)) {
ctx, plannode_id, operator_id, operator_type)), output_type_(output_type) {
}

virtual ~Operator() = default;
Expand Down Expand Up @@ -158,10 +158,15 @@ class Operator {
return "Base Operator";
}

virtual RowTypePtr
OutputType() const {
return output_type_;
}

protected:
std::unique_ptr<OperatorContext> operator_context_;

DataType output_type_;
RowTypePtr output_type_;

RowVectorPtr input_;

Expand Down
38 changes: 19 additions & 19 deletions internal/core/src/plan/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PlanNode {
return id_;
}

virtual DataType
virtual RowTypePtr
output_type() const = 0;

virtual std::vector<std::shared_ptr<PlanNode>>
Expand Down Expand Up @@ -94,9 +94,9 @@ class SegmentNode : public PlanNode {
: PlanNode(id), segment_(segment) {
}

DataType
RowTypePtr
output_type() const override {
return DataType::ROW;
return RowType::None;
}

std::vector<std::shared_ptr<PlanNode>>
Expand Down Expand Up @@ -138,9 +138,9 @@ class ValuesNode : public PlanNode {
AssertInfo(!values.empty(), "ValueNode must has value");
}

DataType
RowTypePtr
output_type() const override {
return output_type_;
return RowType::None;
}

const std::vector<RowVectorPtr>&
Expand Down Expand Up @@ -188,9 +188,9 @@ class FilterNode : public PlanNode {
filter_->type()));
}

DataType
RowTypePtr
output_type() const override {
return sources_[0]->output_type();
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -233,9 +233,9 @@ class FilterBitsNode : public PlanNode {
filter_->type()));
}

DataType
RowTypePtr
output_type() const override {
return DataType::BOOL;
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -278,9 +278,9 @@ class MvccNode : public PlanNode {
: PlanNode(id), sources_{std::move(sources)} {
}

DataType
RowTypePtr
output_type() const override {
return DataType::BOOL;
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -310,9 +310,9 @@ class VectorSearchNode : public PlanNode {
: PlanNode(id), sources_{std::move(sources)} {
}

DataType
RowTypePtr
output_type() const override {
return DataType::BOOL;
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -342,9 +342,9 @@ class SearchGroupByNode : public PlanNode {
: PlanNode(id), sources_{std::move(sources)} {
}

DataType
RowTypePtr
output_type() const override {
return DataType::BOOL;
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -375,9 +375,9 @@ class CountNode : public PlanNode {
: PlanNode(id), sources_{std::move(sources)} {
}

DataType
RowTypePtr
output_type() const override {
return DataType::INT64;
return RowType::None;
}

std::vector<PlanNodePtr>
Expand Down Expand Up @@ -429,9 +429,9 @@ class AggregationNode: public PlanNode {
: PlanNode(id), groupingKeys_(std::move(groupingKeys)), aggregateNames_(std::move(aggNames)), aggregates_(std::move(aggregates)),
sources_(std::move(sources))/*, output_type_(std::move(output_type))*/, ignoreNullKeys_(true){}

DataType
RowTypePtr
output_type() const override {
return DataType::BOOL;
return RowType::None;
}

std::vector<PlanNodePtr> sources() const override {
Expand Down

0 comments on commit 6ce1fd5

Please sign in to comment.