diff --git a/bin/benchmark.cc b/bin/benchmark.cc index aa9f06e03..1cbfd3a7f 100644 --- a/bin/benchmark.cc +++ b/bin/benchmark.cc @@ -22,7 +22,7 @@ #include "neug/execution/common/context.h" #include "neug/execution/common/operators/retrieve/sink.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/execute/plan_parser.h" #include "neug/main/neug_db.h" #include "neug/main/query_request.h" @@ -54,40 +54,40 @@ neug::execution::ParamsMap deserialize_string_kv_map( switch (type.id()) { case neug::DataTypeId::kInt32: { map.emplace(iter.first, - neug::execution::Value::INT32(std::stoi(iter.second))); + neug::Value::INT32(std::stoi(iter.second))); break; } case neug::DataTypeId::kInt64: { map.emplace(iter.first, - neug::execution::Value::INT64(std::stoll(iter.second))); + neug::Value::INT64(std::stoll(iter.second))); break; } case neug::DataTypeId::kUInt32: { map.emplace(iter.first, - neug::execution::Value::UINT32(std::stoul(iter.second))); + neug::Value::UINT32(std::stoul(iter.second))); break; } case neug::DataTypeId::kUInt64: { map.emplace(iter.first, - neug::execution::Value::UINT64(std::stoull(iter.second))); + neug::Value::UINT64(std::stoull(iter.second))); break; } case neug::DataTypeId::kBoolean: { map.emplace(iter.first, - neug::execution::Value::BOOLEAN(iter.second == "true")); + neug::Value::BOOLEAN(iter.second == "true")); break; } case neug::DataTypeId::kVarchar: { - map.emplace(iter.first, neug::execution::Value::STRING(iter.second)); + map.emplace(iter.first, neug::Value::STRING(iter.second)); break; } case neug::DataTypeId::kTimestampMs: { - map.emplace(iter.first, neug::execution::Value::TIMESTAMPMS( + map.emplace(iter.first, neug::Value::TIMESTAMPMS( neug::DateTime(std::stoll(iter.second)))); break; } case neug::DataTypeId::kDate: { - map.emplace(iter.first, neug::execution::Value::DATE(neug::Date( + map.emplace(iter.first, neug::Value::DATE(neug::Date( int64_t(std::stoll(iter.second))))); break; default: diff --git a/doc/source/_scripts/generate_cpp_docs.py b/doc/source/_scripts/generate_cpp_docs.py index 7f5fdb140..cf403723c 100644 --- a/doc/source/_scripts/generate_cpp_docs.py +++ b/doc/source/_scripts/generate_cpp_docs.py @@ -1507,8 +1507,8 @@ def _generate_category_index_md(self, categories: Dict[str, Any]): ```cpp // Safe parameter passing prevents injection neug::execution::ParamsMap params; -params["min_age"] = neug::execution::Value(25); -params["city"] = neug::execution::Value("Beijing"); +params["min_age"] = neug::Value(25); +params["city"] = neug::Value("Beijing"); auto result = conn->Query( "MATCH (p:Person) WHERE p.age > $min_age AND p.city = $city RETURN p", diff --git a/doc/source/reference/cpp_api/connection.md b/doc/source/reference/cpp_api/connection.md index dcf1699da..d6e6a7125 100644 --- a/doc/source/reference/cpp_api/connection.md +++ b/doc/source/reference/cpp_api/connection.md @@ -58,7 +58,7 @@ Compiles and executes a Cypher query string against the database. The query is p auto result = conn->Query("MATCH (n:Person) RETURN n.name", "read"); // Query with parameters neug::execution::ParamsMap params; -params["min_age"] = neug::execution::Value(18); +params["min_age"] = neug::Value(18); result = conn->Query("MATCH (p:Person) WHERE p.age > $min_age RETURN p", "read", params); // Process results diff --git a/extension/gds/include/bfs.h b/extension/gds/include/bfs.h index 9df168562..044409cfd 100644 --- a/extension/gds/include/bfs.h +++ b/extension/gds/include/bfs.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API BFSFunction { static constexpr const char* name = "bfs"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/include/cdlp.h b/extension/gds/include/cdlp.h index 3caa0b6bc..c8ba78ac1 100644 --- a/extension/gds/include/cdlp.h +++ b/extension/gds/include/cdlp.h @@ -27,8 +27,8 @@ struct NEUG_API CDLPFunction { static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, const ::physical::PhysicalPlan& plan, int op_idx); - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static function::function_set getFunctionSet(); }; diff --git a/extension/gds/include/impl/bfs_impl.h b/extension/gds/include/impl/bfs_impl.h index a8c343c41..6db282035 100644 --- a/extension/gds/include/impl/bfs_impl.h +++ b/extension/gds/include/impl/bfs_impl.h @@ -18,7 +18,7 @@ #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" namespace neug { diff --git a/extension/gds/include/impl/bfs_pred_impl.h b/extension/gds/include/impl/bfs_pred_impl.h index 4d26b7e25..3fa352606 100644 --- a/extension/gds/include/impl/bfs_pred_impl.h +++ b/extension/gds/include/impl/bfs_pred_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/cdlp_impl.h b/extension/gds/include/impl/cdlp_impl.h index b015e892e..647e8ba87 100644 --- a/extension/gds/include/impl/cdlp_impl.h +++ b/extension/gds/include/impl/cdlp_impl.h @@ -19,7 +19,8 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/execution/expression/predicates.h" @@ -31,8 +32,7 @@ namespace gds { class CDLP { public: CDLP(const StorageReadInterface& graph, label_t vertex_label, - const execution::LabelTriplet& edge_triplet, int max_iterations, - int concurrency); + const LabelTriplet& edge_triplet, int max_iterations, int concurrency); void compute(); void sink(execution::Context& ctx, int32_t node_alias, int32_t label_alias); @@ -49,7 +49,7 @@ class CDLP { const StorageReadInterface& graph_; label_t vertex_label_; - execution::LabelTriplet edge_triplet_; + LabelTriplet edge_triplet_; int max_iterations_; int concurrency_; diff --git a/extension/gds/include/impl/cdlp_pred_impl.h b/extension/gds/include/impl/cdlp_pred_impl.h index 65022b7f9..3a603d386 100644 --- a/extension/gds/include/impl/cdlp_pred_impl.h +++ b/extension/gds/include/impl/cdlp_pred_impl.h @@ -19,7 +19,8 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" @@ -36,7 +37,7 @@ namespace gds { class CDLPPred { public: CDLPPred(const StorageReadInterface& graph, label_t vertex_label, - const execution::LabelTriplet& edge_triplet, int max_iterations, + const LabelTriplet& edge_triplet, int max_iterations, int concurrency, execution::ExprBase* vertex_pred, execution::ExprBase* edge_pred); @@ -46,7 +47,7 @@ class CDLPPred { private: const StorageReadInterface& graph_; label_t vertex_label_; - execution::LabelTriplet edge_triplet_; + LabelTriplet edge_triplet_; int max_iterations_; int concurrency_; execution::ExprBase* vertex_pred_; diff --git a/extension/gds/include/impl/kcore_impl.h b/extension/gds/include/impl/kcore_impl.h index 5b28fc1d7..dba96acc3 100644 --- a/extension/gds/include/impl/kcore_impl.h +++ b/extension/gds/include/impl/kcore_impl.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/kcore_pred_impl.h b/extension/gds/include/impl/kcore_pred_impl.h index c47c3d5c5..2c497a8b9 100644 --- a/extension/gds/include/impl/kcore_pred_impl.h +++ b/extension/gds/include/impl/kcore_pred_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/lcc_directed_impl.h b/extension/gds/include/impl/lcc_directed_impl.h index 82bf95444..cba2b3c0f 100644 --- a/extension/gds/include/impl/lcc_directed_impl.h +++ b/extension/gds/include/impl/lcc_directed_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/lcc_pred_impl.h b/extension/gds/include/impl/lcc_pred_impl.h index 9753deb3f..94b72c5e5 100644 --- a/extension/gds/include/impl/lcc_pred_impl.h +++ b/extension/gds/include/impl/lcc_pred_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/lcc_undirected_impl.h b/extension/gds/include/impl/lcc_undirected_impl.h index e515a33ec..3879292e4 100644 --- a/extension/gds/include/impl/lcc_undirected_impl.h +++ b/extension/gds/include/impl/lcc_undirected_impl.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/page_rank_directed_impl.h b/extension/gds/include/impl/page_rank_directed_impl.h index 6f54efb14..c87ccda25 100644 --- a/extension/gds/include/impl/page_rank_directed_impl.h +++ b/extension/gds/include/impl/page_rank_directed_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/expression/expr.h" namespace neug { diff --git a/extension/gds/include/impl/page_rank_pred_impl.h b/extension/gds/include/impl/page_rank_pred_impl.h index 359dd6c29..edd60ef1d 100644 --- a/extension/gds/include/impl/page_rank_pred_impl.h +++ b/extension/gds/include/impl/page_rank_pred_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/page_rank_undirected_impl.h b/extension/gds/include/impl/page_rank_undirected_impl.h index e4fb716c8..709010cf9 100644 --- a/extension/gds/include/impl/page_rank_undirected_impl.h +++ b/extension/gds/include/impl/page_rank_undirected_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/expression/expr.h" namespace neug { diff --git a/extension/gds/include/impl/sssp_impl.h b/extension/gds/include/impl/sssp_impl.h index 648cba502..0197fe206 100644 --- a/extension/gds/include/impl/sssp_impl.h +++ b/extension/gds/include/impl/sssp_impl.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/sssp_pred_impl.h b/extension/gds/include/impl/sssp_pred_impl.h index 84919555d..837ecb8e8 100644 --- a/extension/gds/include/impl/sssp_pred_impl.h +++ b/extension/gds/include/impl/sssp_pred_impl.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/wcc_impl.h b/extension/gds/include/impl/wcc_impl.h index 74b114426..8ec5a1f74 100644 --- a/extension/gds/include/impl/wcc_impl.h +++ b/extension/gds/include/impl/wcc_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/impl/wcc_pred_impl.h b/extension/gds/include/impl/wcc_pred_impl.h index 038397686..075d250db 100644 --- a/extension/gds/include/impl/wcc_pred_impl.h +++ b/extension/gds/include/impl/wcc_pred_impl.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include "neug/execution/common/context.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" diff --git a/extension/gds/include/kcore.h b/extension/gds/include/kcore.h index 66e98b22e..e61e68907 100644 --- a/extension/gds/include/kcore.h +++ b/extension/gds/include/kcore.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API KCoreFunction { static constexpr const char* name = "kcore"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/include/lcc.h b/extension/gds/include/lcc.h index c899a53bc..3f1268731 100644 --- a/extension/gds/include/lcc.h +++ b/extension/gds/include/lcc.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API LCCFunction { static constexpr const char* name = "lcc"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/include/leiden.h b/extension/gds/include/leiden.h index 48a9b7d64..9acfd5530 100644 --- a/extension/gds/include/leiden.h +++ b/extension/gds/include/leiden.h @@ -30,7 +30,7 @@ struct NEUG_API LeidenFunction { const ::physical::PhysicalPlan& plan, int op_idx); static execution::Context exec(const function::CallFuncInputBase& input_base, - neug::IStorageInterface& g); + IStorageInterface& g); static function::function_set getFunctionSet(); }; diff --git a/extension/gds/include/louvain.h b/extension/gds/include/louvain.h index 251ad8e93..d4c490597 100644 --- a/extension/gds/include/louvain.h +++ b/extension/gds/include/louvain.h @@ -30,7 +30,7 @@ struct NEUG_API LouvainFunction { const ::physical::PhysicalPlan& plan, int op_idx); static execution::Context exec(const function::CallFuncInputBase& input_base, - neug::IStorageInterface& g); + IStorageInterface& g); static function::function_set getFunctionSet(); }; diff --git a/extension/gds/include/page_rank.h b/extension/gds/include/page_rank.h index 550885027..db4f0011a 100644 --- a/extension/gds/include/page_rank.h +++ b/extension/gds/include/page_rank.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API PageRankFunction { static constexpr const char* name = "page_rank"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/include/sssp.h b/extension/gds/include/sssp.h index 287402f8d..32880c01a 100644 --- a/extension/gds/include/sssp.h +++ b/extension/gds/include/sssp.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API SSSPFunction { static constexpr const char* name = "sssp"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/include/utils/path_utils.h b/extension/gds/include/utils/path_utils.h index aa9b73c69..a9475077f 100644 --- a/extension/gds/include/utils/path_utils.h +++ b/extension/gds/include/utils/path_utils.h @@ -21,15 +21,15 @@ #include #include +#include "neug/common/columns/path_columns.h" #include "neug/common/extra_type_info.h" #include "neug/common/types.h" +#include "neug/common/types/graph_types.h" #include "neug/compiler/binder/expression/expression.h" #include "neug/compiler/common/constants.h" #include "neug/compiler/function/gds/gds_algo_function.h" #include "neug/compiler/function/table/table_function.h" -#include "neug/execution/common/columns/path_columns.h" #include "neug/execution/common/operators/retrieve/sink.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/storages/graph/graph_interface.h" namespace neug { @@ -38,11 +38,12 @@ namespace gds { // Build a Path object from a predecessor chain, looking up real edge data // pointers from the CSR graph view. The caller provides the vertex chain in // source-to-target order. -inline execution::Path build_path_from_chain( - const std::vector& chain, label_t vertex_label, label_t edge_label, - bool directed, const StorageReadInterface& graph) { +inline Path build_path_from_chain(const std::vector& chain, + label_t vertex_label, label_t edge_label, + bool directed, + const StorageReadInterface& graph) { if (chain.size() <= 1) { - return execution::Path(vertex_label, chain[0]); + return Path(vertex_label, chain[0]); } auto oe_view = @@ -50,14 +51,14 @@ inline execution::Path build_path_from_chain( auto ie_view = graph.GetGenericIncomingGraphView(vertex_label, vertex_label, edge_label); - std::vector> edge_datas; + std::vector> edge_datas; edge_datas.reserve(chain.size() - 1); for (size_t i = 0; i + 1 < chain.size(); ++i) { vid_t from = chain[i]; vid_t to = chain[i + 1]; const void* prop = nullptr; - execution::Direction dir = execution::Direction::kOut; + Direction dir = Direction::kOut; // Try outgoing edges first auto oe_edges = oe_view.get_edges(from); @@ -74,7 +75,7 @@ inline execution::Path build_path_from_chain( for (auto it = ie_edges.begin(); it != ie_edges.end(); ++it) { if (*it == to) { prop = it.get_data_ptr(); - dir = execution::Direction::kIn; + dir = Direction::kIn; break; } } @@ -83,7 +84,7 @@ inline execution::Path build_path_from_chain( edge_datas.push_back({dir, prop}); } - return execution::Path(vertex_label, edge_label, chain, edge_datas); + return Path(vertex_label, edge_label, chain, edge_datas); } // Reconstruct a path by walking backward from `target` to `source` using @@ -92,11 +93,10 @@ inline execution::Path build_path_from_chain( // vertex ID. This enables post-hoc path reconstruction from the distance // array without storing predecessors during computation. template -inline execution::Path reconstruct_path(vid_t target, vid_t source, - const PredFinder& find_pred, - label_t vertex_label, - label_t edge_label, bool directed, - const StorageReadInterface& graph) { +inline Path reconstruct_path(vid_t target, vid_t source, + const PredFinder& find_pred, label_t vertex_label, + label_t edge_label, bool directed, + const StorageReadInterface& graph) { std::vector chain; vid_t cur = target; while (cur != source) { diff --git a/extension/gds/include/utils/subgraph_utils.h b/extension/gds/include/utils/subgraph_utils.h index 81642a616..907c80df6 100644 --- a/extension/gds/include/utils/subgraph_utils.h +++ b/extension/gds/include/utils/subgraph_utils.h @@ -20,6 +20,7 @@ #include #include +#include "neug/common/types/graph_types.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" @@ -32,7 +33,7 @@ struct ParsedSubgraphEntry { }; struct ParsedSubgraphEdgeEntry { - execution::LabelTriplet triplet; + LabelTriplet triplet; std::unique_ptr predicate; }; diff --git a/extension/gds/include/wcc.h b/extension/gds/include/wcc.h index ca5a13bc5..9c557f82c 100644 --- a/extension/gds/include/wcc.h +++ b/extension/gds/include/wcc.h @@ -23,8 +23,8 @@ namespace neug { namespace gds { struct NEUG_API WCCFunction { static constexpr const char* name = "wcc"; - static neug::execution::Context exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& graph); + static execution::Context exec(const function::CallFuncInputBase& input, + IStorageInterface& graph); static std::unique_ptr bind( const Schema& schema, const execution::ContextMeta& ctx_meta, diff --git a/extension/gds/src/bfs.cc b/extension/gds/src/bfs.cc index 541553e74..4eb7cb7b7 100644 --- a/extension/gds/src/bfs.cc +++ b/extension/gds/src/bfs.cc @@ -97,7 +97,7 @@ std::unique_ptr BFSFunction::bind( } execution::Context BFSFunction::exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& g) { + IStorageInterface& g) { const auto& bfs_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/cdlp.cc b/extension/gds/src/cdlp.cc index 22db5f7a9..71d1cd7e9 100644 --- a/extension/gds/src/cdlp.cc +++ b/extension/gds/src/cdlp.cc @@ -53,7 +53,7 @@ struct CDLPInput : public function::CallFuncInputBase { label_t vertex_label; std::unique_ptr vertex_pred; - execution::LabelTriplet edge_triplet; + LabelTriplet edge_triplet; std::unique_ptr edge_pred; int32_t max_iterations; int32_t node_alias, label_alias; @@ -90,7 +90,7 @@ std::unique_ptr CDLPFunction::bind( } execution::Context CDLPFunction::exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& g) { + IStorageInterface& g) { const auto& lp_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/impl/bfs_impl.cc b/extension/gds/src/impl/bfs_impl.cc index c770ce833..b64f70ca4 100644 --- a/extension/gds/src/impl/bfs_impl.cc +++ b/extension/gds/src/impl/bfs_impl.cc @@ -22,8 +22,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/context.h" #include "utils/parallel_utils.h" #include "utils/path_utils.h" @@ -159,12 +159,12 @@ void BFS::compute() { void BFS::sink(execution::Context& ctx, int node_alias, int distance_alias, int path_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder distance_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder distance_builder; distance_builder.reserve(vertices_.size()); - std::shared_ptr path_column; + std::shared_ptr path_column; if (return_path_) { auto oe_view = graph_.GetGenericOutgoingGraphView( vertex_label_, vertex_label_, edge_label_); @@ -189,7 +189,7 @@ void BFS::sink(execution::Context& ctx, int node_alias, int distance_alias, return source_; }; - execution::PathColumnBuilder path_builder; + PathColumnBuilder path_builder; for (vid_t v : vertices_) { if (distances_[v] == std::numeric_limits::max()) { path_builder.push_back_null(); @@ -210,7 +210,7 @@ void BFS::sink(execution::Context& ctx, int node_alias, int distance_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(distance_alias, distance_builder.finish()); diff --git a/extension/gds/src/impl/bfs_pred_impl.cc b/extension/gds/src/impl/bfs_pred_impl.cc index 12895c5b5..3abc0a457 100644 --- a/extension/gds/src/impl/bfs_pred_impl.cc +++ b/extension/gds/src/impl/bfs_pred_impl.cc @@ -21,8 +21,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" #include "utils/path_utils.h" @@ -70,7 +70,7 @@ void BFSPred::compute() { } } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -122,11 +122,11 @@ void BFSPred::compute() { void BFSPred::sink(execution::Context& ctx, int node_alias, int distance_alias, int path_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder distance_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder distance_builder; distance_builder.reserve(vertices_.size()); - std::shared_ptr path_column; + std::shared_ptr path_column; if (return_path_) { auto oe_view = graph_.GetGenericOutgoingGraphView( vertex_label_, vertex_label_, edge_label_); @@ -138,7 +138,7 @@ void BFSPred::sink(execution::Context& ctx, int node_alias, int distance_alias, epred = std::make_unique( edge_pred_->bind(&graph_, {})); } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto find_pred = [&](vid_t v) -> vid_t { auto ie_edges = ie_view.get_edges(v); @@ -164,7 +164,7 @@ void BFSPred::sink(execution::Context& ctx, int node_alias, int distance_alias, return source_; }; - execution::PathColumnBuilder path_builder; + PathColumnBuilder path_builder; for (vid_t v : vertices_) { if (distances_[v] == std::numeric_limits::max()) { path_builder.push_back_null(); @@ -185,7 +185,7 @@ void BFSPred::sink(execution::Context& ctx, int node_alias, int distance_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(distance_alias, distance_builder.finish()); diff --git a/extension/gds/src/impl/cdlp_impl.cc b/extension/gds/src/impl/cdlp_impl.cc index 7d99847c4..9d62d4d1b 100644 --- a/extension/gds/src/impl/cdlp_impl.cc +++ b/extension/gds/src/impl/cdlp_impl.cc @@ -22,15 +22,15 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { namespace gds { CDLP::CDLP(const StorageReadInterface& graph, label_t vertex_label, - const execution::LabelTriplet& edge_triplet, int max_iterations, + const LabelTriplet& edge_triplet, int max_iterations, int concurrency) : graph_(graph), vertex_label_(vertex_label), @@ -222,8 +222,8 @@ void CDLP::compute() { void CDLP::sink(execution::Context& ctx, int32_t node_alias, int32_t label_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder label_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder label_builder; label_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -231,7 +231,7 @@ void CDLP::sink(execution::Context& ctx, int32_t node_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(label_alias, label_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/cdlp_pred_impl.cc b/extension/gds/src/impl/cdlp_pred_impl.cc index c2ac0a61c..50481c1a5 100644 --- a/extension/gds/src/impl/cdlp_pred_impl.cc +++ b/extension/gds/src/impl/cdlp_pred_impl.cc @@ -21,8 +21,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -33,9 +33,8 @@ constexpr int64_t kExcluded = std::numeric_limits::max(); } // namespace CDLPPred::CDLPPred(const StorageReadInterface& graph, label_t vertex_label, - const execution::LabelTriplet& edge_triplet, - int max_iterations, int concurrency, - execution::ExprBase* vertex_pred, + const LabelTriplet& edge_triplet, int max_iterations, + int concurrency, execution::ExprBase* vertex_pred, execution::ExprBase* edge_pred) : graph_(graph), vertex_label_(vertex_label), @@ -148,8 +147,8 @@ void CDLPPred::compute() { void CDLPPred::sink(execution::Context& ctx, int32_t node_alias, int32_t label_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder label_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder label_builder; label_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -157,7 +156,7 @@ void CDLPPred::sink(execution::Context& ctx, int32_t node_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(label_alias, label_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/kcore_impl.cc b/extension/gds/src/impl/kcore_impl.cc index f57fd695e..244dfaf32 100644 --- a/extension/gds/src/impl/kcore_impl.cc +++ b/extension/gds/src/impl/kcore_impl.cc @@ -20,8 +20,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { @@ -147,8 +147,8 @@ void KCore::compute() { } void KCore::sink(execution::Context& ctx, int node_alias, int core_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder core_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder core_builder; node_builder.reserve(vertices_.size()); core_builder.reserve(vertices_.size()); @@ -163,7 +163,7 @@ void KCore::sink(execution::Context& ctx, int node_alias, int core_alias) { } } - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(core_alias, core_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/kcore_pred_impl.cc b/extension/gds/src/impl/kcore_pred_impl.cc index 3856fa49c..8fb50120c 100644 --- a/extension/gds/src/impl/kcore_pred_impl.cc +++ b/extension/gds/src/impl/kcore_pred_impl.cc @@ -19,8 +19,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -67,7 +67,7 @@ void KCorePred::compute() { } } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -142,8 +142,8 @@ void KCorePred::compute() { } void KCorePred::sink(execution::Context& ctx, int node_alias, int core_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder core_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder core_builder; core_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -152,7 +152,7 @@ void KCorePred::sink(execution::Context& ctx, int node_alias, int core_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(core_alias, core_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/lcc_directed_impl.cc b/extension/gds/src/impl/lcc_directed_impl.cc index 66d4004f8..46edd79d4 100644 --- a/extension/gds/src/impl/lcc_directed_impl.cc +++ b/extension/gds/src/impl/lcc_directed_impl.cc @@ -20,8 +20,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { @@ -158,8 +158,8 @@ void LCCDirected::compute() { } void LCCDirected::sink(execution::Context& ctx, int node_alias, int lcc_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder lcc_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder lcc_builder; lcc_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -167,7 +167,7 @@ void LCCDirected::sink(execution::Context& ctx, int node_alias, int lcc_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(lcc_alias, lcc_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/lcc_pred_impl.cc b/extension/gds/src/impl/lcc_pred_impl.cc index a9d2ad828..d886e919e 100644 --- a/extension/gds/src/impl/lcc_pred_impl.cc +++ b/extension/gds/src/impl/lcc_pred_impl.cc @@ -22,8 +22,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -71,7 +71,7 @@ void LCCPred::compute() { } } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -167,8 +167,8 @@ void LCCPred::compute() { } void LCCPred::sink(execution::Context& ctx, int node_alias, int lcc_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder lcc_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder lcc_builder; lcc_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -176,7 +176,7 @@ void LCCPred::sink(execution::Context& ctx, int node_alias, int lcc_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(lcc_alias, lcc_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/lcc_undirected_impl.cc b/extension/gds/src/impl/lcc_undirected_impl.cc index f6986b97e..fae3c1532 100644 --- a/extension/gds/src/impl/lcc_undirected_impl.cc +++ b/extension/gds/src/impl/lcc_undirected_impl.cc @@ -20,8 +20,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { @@ -236,8 +236,8 @@ void LCCUndirected::compute() { void LCCUndirected::sink(execution::Context& ctx, int node_alias, int lcc_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder lcc_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder lcc_builder; lcc_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -245,7 +245,7 @@ void LCCUndirected::sink(execution::Context& ctx, int node_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(lcc_alias, lcc_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/leiden_impl.cc b/extension/gds/src/impl/leiden_impl.cc index 516f0e5d2..c91c1de07 100644 --- a/extension/gds/src/impl/leiden_impl.cc +++ b/extension/gds/src/impl/leiden_impl.cc @@ -22,8 +22,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { @@ -463,9 +463,9 @@ void Leiden::refine() { void Leiden::sink(execution::Context& ctx, int node_alias, int community_alias) { - execution::MSVertexColumnBuilder builder(vertex_label_); + MSVertexColumnBuilder builder(vertex_label_); builder.reserve(valid_vertices_.size()); - execution::ValueColumnBuilder community_builder; + ValueColumnBuilder community_builder; community_builder.reserve(valid_vertices_.size()); std::unordered_map com_remap; @@ -479,7 +479,7 @@ void Leiden::sink(execution::Context& ctx, int node_alias, community_builder.push_back_opt(static_cast(com_remap[c])); } - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, builder.finish()); chunk.set(community_alias, community_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/louvain_impl.cc b/extension/gds/src/impl/louvain_impl.cc index 1c97b4472..03dd63f4b 100644 --- a/extension/gds/src/impl/louvain_impl.cc +++ b/extension/gds/src/impl/louvain_impl.cc @@ -22,8 +22,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" namespace neug { @@ -322,9 +322,9 @@ bool Louvain::one_level() { void Louvain::sink(execution::Context& ctx, int node_alias, int community_alias) { - execution::MSVertexColumnBuilder builder(vertex_label_); + MSVertexColumnBuilder builder(vertex_label_); builder.reserve(valid_vertices_.size()); - execution::ValueColumnBuilder community_builder; + ValueColumnBuilder community_builder; community_builder.reserve(valid_vertices_.size()); // Remap communities to contiguous [0, num_coms) @@ -339,7 +339,7 @@ void Louvain::sink(execution::Context& ctx, int node_alias, community_builder.push_back_opt(static_cast(com_remap[c])); } - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, builder.finish()); chunk.set(community_alias, community_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/page_rank_directed_impl.cc b/extension/gds/src/impl/page_rank_directed_impl.cc index e22d1e13d..9bea2282d 100644 --- a/extension/gds/src/impl/page_rank_directed_impl.cc +++ b/extension/gds/src/impl/page_rank_directed_impl.cc @@ -16,8 +16,8 @@ #include "impl/page_rank_directed_impl.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/context.h" #include "utils/parallel_utils.h" @@ -114,15 +114,15 @@ void DirectedPageRank::compute(int max_iterations) { void DirectedPageRank::sink(execution::Context& ctx, int node_alias, int pr_alias) { - execution::MSVertexColumnBuilder builder(vertex_label_); + MSVertexColumnBuilder builder(vertex_label_); builder.reserve(valid_vertices_.size()); - execution::ValueColumnBuilder pr_builder; + ValueColumnBuilder pr_builder; pr_builder.reserve(valid_vertices_.size()); for (vid_t v : valid_vertices_) { builder.push_back_opt(v); pr_builder.push_back_opt(pr_[v]); } - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, builder.finish()); chunk.set(pr_alias, pr_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/page_rank_pred_impl.cc b/extension/gds/src/impl/page_rank_pred_impl.cc index d92c970a0..8eed4f8c4 100644 --- a/extension/gds/src/impl/page_rank_pred_impl.cc +++ b/extension/gds/src/impl/page_rank_pred_impl.cc @@ -19,8 +19,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -74,7 +74,7 @@ void PageRankPred::compute() { return; } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -184,8 +184,8 @@ void PageRankPred::compute() { } void PageRankPred::sink(execution::Context& ctx, int node_alias, int pr_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder pr_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder pr_builder; pr_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -193,7 +193,7 @@ void PageRankPred::sink(execution::Context& ctx, int node_alias, int pr_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(pr_alias, pr_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/page_rank_undirected_impl.cc b/extension/gds/src/impl/page_rank_undirected_impl.cc index f90c9f4d3..0680ed42e 100644 --- a/extension/gds/src/impl/page_rank_undirected_impl.cc +++ b/extension/gds/src/impl/page_rank_undirected_impl.cc @@ -16,8 +16,8 @@ #include "impl/page_rank_undirected_impl.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/context.h" #include "utils/parallel_utils.h" @@ -121,16 +121,16 @@ void UndirectedPageRank::compute(int max_iterations) { void UndirectedPageRank::sink(execution::Context& ctx, int node_alias, int pr_alias) { - execution::MSVertexColumnBuilder builder(vertex_label_); + MSVertexColumnBuilder builder(vertex_label_); - execution::ValueColumnBuilder pr_builder; + ValueColumnBuilder pr_builder; pr_builder.reserve(valid_vertices_.size()); for (vid_t v : valid_vertices_) { pr_builder.push_back_opt(pr_[v]); } builder.append(vertex_label_, std::move(valid_vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, builder.finish()); chunk.set(pr_alias, pr_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/sssp_impl.cc b/extension/gds/src/impl/sssp_impl.cc index 137f6297c..cbb9413ad 100644 --- a/extension/gds/src/impl/sssp_impl.cc +++ b/extension/gds/src/impl/sssp_impl.cc @@ -23,8 +23,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "utils/parallel_utils.h" #include "utils/subgraph_utils.h" @@ -179,8 +179,8 @@ void SSSP::compute() { } void SSSP::sink(execution::Context& ctx, int node_alias, int distance_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder distance_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder distance_builder; distance_builder.reserve(vertices_.size()); @@ -190,7 +190,7 @@ void SSSP::sink(execution::Context& ctx, int node_alias, int distance_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(distance_alias, distance_builder.finish()); diff --git a/extension/gds/src/impl/sssp_pred_impl.cc b/extension/gds/src/impl/sssp_pred_impl.cc index a55ae01f8..43879aa74 100644 --- a/extension/gds/src/impl/sssp_pred_impl.cc +++ b/extension/gds/src/impl/sssp_pred_impl.cc @@ -23,8 +23,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" #include "utils/path_utils.h" @@ -82,7 +82,7 @@ void SSSPPred::compute() { vertex_label_, vertex_label_, edge_label_, edge_weight_prop_)); } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -138,11 +138,11 @@ void SSSPPred::compute() { void SSSPPred::sink(execution::Context& ctx, int node_alias, int distance_alias, int path_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder distance_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder distance_builder; distance_builder.reserve(vertices_.size()); - std::shared_ptr path_column; + std::shared_ptr path_column; if (return_path_) { auto oe_view = graph_.GetGenericOutgoingGraphView( vertex_label_, vertex_label_, edge_label_); @@ -162,7 +162,7 @@ void SSSPPred::sink(execution::Context& ctx, int node_alias, int distance_alias, epred = std::make_unique( edge_pred_->bind(&graph_, {})); } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto find_pred = [&](vid_t v) -> vid_t { double dv = distances_[v]; @@ -199,7 +199,7 @@ void SSSPPred::sink(execution::Context& ctx, int node_alias, int distance_alias, return source_; }; - execution::PathColumnBuilder path_builder; + PathColumnBuilder path_builder; for (vid_t v : vertices_) { if (distances_[v] < 0) { path_builder.push_back_null(); @@ -217,7 +217,7 @@ void SSSPPred::sink(execution::Context& ctx, int node_alias, int distance_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(distance_alias, distance_builder.finish()); diff --git a/extension/gds/src/impl/wcc_impl.cc b/extension/gds/src/impl/wcc_impl.cc index cc5774fea..a7fd2877a 100644 --- a/extension/gds/src/impl/wcc_impl.cc +++ b/extension/gds/src/impl/wcc_impl.cc @@ -22,8 +22,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/context.h" #include "neug/storages/csr/csr_view.h" #include "utils/parallel_utils.h" @@ -261,8 +261,8 @@ void WCC::compute() { } void WCC::sink(execution::Context& ctx, int node_alias, int component_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder component_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder component_builder; size_t vertex_count = vertices_.size(); component_builder.reserve(vertex_count); @@ -271,7 +271,7 @@ void WCC::sink(execution::Context& ctx, int node_alias, int component_alias) { } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(component_alias, component_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/impl/wcc_pred_impl.cc b/extension/gds/src/impl/wcc_pred_impl.cc index 67fce33e9..4b9bddd8b 100644 --- a/extension/gds/src/impl/wcc_pred_impl.cc +++ b/extension/gds/src/impl/wcc_pred_impl.cc @@ -21,8 +21,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -75,7 +75,7 @@ void WCCPred::compute() { } } - execution::LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; + LabelTriplet triplet{vertex_label_, vertex_label_, edge_label_}; auto oe_view = graph_.GetGenericOutgoingGraphView(vertex_label_, vertex_label_, edge_label_); auto ie_view = graph_.GetGenericIncomingGraphView(vertex_label_, @@ -134,8 +134,8 @@ void WCCPred::compute() { void WCCPred::sink(execution::Context& ctx, int node_alias, int component_alias) { - execution::MSVertexColumnBuilder node_builder(vertex_label_); - execution::ValueColumnBuilder component_builder; + MSVertexColumnBuilder node_builder(vertex_label_); + ValueColumnBuilder component_builder; component_builder.reserve(vertices_.size()); for (vid_t v : vertices_) { @@ -143,7 +143,7 @@ void WCCPred::sink(execution::Context& ctx, int node_alias, } node_builder.append(vertex_label_, std::move(vertices_)); - execution::ContextChunk chunk; + DataChunk chunk; chunk.set(node_alias, node_builder.finish()); chunk.set(component_alias, component_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/extension/gds/src/kcore.cc b/extension/gds/src/kcore.cc index 95b09048a..c598511d4 100644 --- a/extension/gds/src/kcore.cc +++ b/extension/gds/src/kcore.cc @@ -93,7 +93,7 @@ std::unique_ptr KCoreFunction::bind( } execution::Context KCoreFunction::exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& g) { + IStorageInterface& g) { const auto& kcore_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/lcc.cc b/extension/gds/src/lcc.cc index b898b2090..292399af6 100644 --- a/extension/gds/src/lcc.cc +++ b/extension/gds/src/lcc.cc @@ -96,7 +96,7 @@ std::unique_ptr LCCFunction::bind( } execution::Context LCCFunction::exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& g) { + IStorageInterface& g) { const auto& lcc_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/leiden.cc b/extension/gds/src/leiden.cc index 0f7908e9a..6c1008bfc 100644 --- a/extension/gds/src/leiden.cc +++ b/extension/gds/src/leiden.cc @@ -95,7 +95,7 @@ std::unique_ptr LeidenFunction::bind( } execution::Context LeidenFunction::exec( - const function::CallFuncInputBase& input_base, neug::IStorageInterface& g) { + const function::CallFuncInputBase& input_base, IStorageInterface& g) { const auto& input = dynamic_cast(input_base); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/louvain.cc b/extension/gds/src/louvain.cc index 169c7b47b..cc9ef073a 100644 --- a/extension/gds/src/louvain.cc +++ b/extension/gds/src/louvain.cc @@ -95,7 +95,7 @@ std::unique_ptr LouvainFunction::bind( } execution::Context LouvainFunction::exec( - const function::CallFuncInputBase& input_base, neug::IStorageInterface& g) { + const function::CallFuncInputBase& input_base, IStorageInterface& g) { const auto& input = dynamic_cast(input_base); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/page_rank.cc b/extension/gds/src/page_rank.cc index 6aff14599..b55486198 100644 --- a/extension/gds/src/page_rank.cc +++ b/extension/gds/src/page_rank.cc @@ -91,7 +91,7 @@ std::unique_ptr PageRankFunction::bind( } execution::Context PageRankFunction::exec( - const function::CallFuncInputBase& input, neug::IStorageInterface& g) { + const function::CallFuncInputBase& input, IStorageInterface& g) { const auto& func_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); execution::Context ret; diff --git a/extension/gds/src/sssp.cc b/extension/gds/src/sssp.cc index 77076ed62..d2a45aaf5 100644 --- a/extension/gds/src/sssp.cc +++ b/extension/gds/src/sssp.cc @@ -99,7 +99,7 @@ std::unique_ptr SSSPFunction::bind( } execution::Context SSSPFunction::exec(const function::CallFuncInputBase& input, - neug::IStorageInterface& g) { + IStorageInterface& g) { const auto& sssp_input = dynamic_cast(input); const auto& graph = dynamic_cast(g); diff --git a/extension/gds/src/utils/subgraph_utils.cc b/extension/gds/src/utils/subgraph_utils.cc index 83f202135..fc1070b7b 100644 --- a/extension/gds/src/utils/subgraph_utils.cc +++ b/extension/gds/src/utils/subgraph_utils.cc @@ -54,9 +54,9 @@ bool parse_subgraph_entries(const ::physical::Subgraph& subgraph, } ParsedSubgraphEdgeEntry parsed_edge; - parsed_edge.triplet = execution::LabelTriplet(edge_entry.src_label_id(), - edge_entry.dst_label_id(), - edge_entry.edge_label_id()); + parsed_edge.triplet = + LabelTriplet(edge_entry.src_label_id(), edge_entry.dst_label_id(), + edge_entry.edge_label_id()); if (edge_entry.has_predicate()) { parsed_edge.predicate = execution::parse_expression( edge_entry.predicate(), ctx_meta, execution::VarType::kEdge); @@ -99,23 +99,23 @@ bool try_parse_source_vertex(const StorageReadInterface& graph, auto pk_type = std::get<0>(graph.schema().get_vertex_primary_key(vertex_label)[0]); - execution::Value oid; + Value oid; try { switch (pk_type.id()) { case DataTypeId::kInt32: - oid = execution::Value::INT32(std::stoi(source_str)); + oid = Value::INT32(std::stoi(source_str)); break; case DataTypeId::kInt64: - oid = execution::Value::INT64(std::atoll(source_str.c_str())); + oid = Value::INT64(std::atoll(source_str.c_str())); break; case DataTypeId::kUInt32: - oid = execution::Value::UINT32(std::stoul(source_str)); + oid = Value::UINT32(std::stoul(source_str)); break; case DataTypeId::kUInt64: - oid = execution::Value::UINT64(std::stoull(source_str)); + oid = Value::UINT64(std::stoull(source_str)); break; case DataTypeId::kVarchar: - oid = execution::Value::CreateValue(source_str); + oid = Value::CreateValue(source_str); break; default: LOG(ERROR) << "Unsupported primary key type for source vertex lookup."; diff --git a/extension/gds/src/wcc.cc b/extension/gds/src/wcc.cc index 9bad1d934..1bb5ee7a2 100644 --- a/extension/gds/src/wcc.cc +++ b/extension/gds/src/wcc.cc @@ -83,7 +83,7 @@ std::unique_ptr WCCFunction::bind( } execution::Context WCCFunction::exec( - const function::CallFuncInputBase& input_base, neug::IStorageInterface& g) { + const function::CallFuncInputBase& input_base, IStorageInterface& g) { const auto& input = dynamic_cast(input_base); const auto& graph = dynamic_cast(g); diff --git a/extension/parquet/include/parquet/arrow_context_column.h b/extension/parquet/include/parquet/arrow_column.h similarity index 89% rename from extension/parquet/include/parquet/arrow_context_column.h rename to extension/parquet/include/parquet/arrow_column.h index 2c0872c57..d70640996 100644 --- a/extension/parquet/include/parquet/arrow_context_column.h +++ b/extension/parquet/include/parquet/arrow_column.h @@ -21,11 +21,10 @@ #include #include -#include "neug/execution/common/columns/i_context_column.h" -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" +#include "neug/common/types/i_context_column.h" namespace neug { -namespace execution { /// Convert a single Arrow array to a ValueColumn. std::shared_ptr arrow_array_to_value_column( @@ -39,5 +38,4 @@ std::shared_ptr arrow_arrays_to_value_column( std::shared_ptr recordbatch_to_value_datachunk( const std::shared_ptr& batch); -} // namespace execution } // namespace neug diff --git a/extension/parquet/include/parquet/record_batch_supplier.h b/extension/parquet/include/parquet/record_batch_supplier.h index a8a94d2fc..acf5ff6ac 100644 --- a/extension/parquet/include/parquet/record_batch_supplier.h +++ b/extension/parquet/include/parquet/record_batch_supplier.h @@ -18,6 +18,7 @@ #include #include +#include "neug/common/types/data_chunk.h" #include "neug/storages/loader/loader_utils.h" namespace neug { @@ -28,7 +29,7 @@ class RecordBatchChunkSupplier : public IDataChunkSupplier { const std::shared_ptr& reader, int64_t row_num) : row_num_(row_num), reader_(reader) {} - std::shared_ptr GetNextChunk() override; + std::shared_ptr GetNextChunk() override; int64_t RowNum() const override { return row_num_; } diff --git a/extension/parquet/include/parquet_export_function.h b/extension/parquet/include/parquet_export_function.h index b5b22e476..827183f43 100644 --- a/extension/parquet/include/parquet_export_function.h +++ b/extension/parquet/include/parquet_export_function.h @@ -38,7 +38,7 @@ class ArrowParquetExportWriter : public QueryExportWriter { fileSystem_(std::move(fileSystem)) {} ~ArrowParquetExportWriter() override = default; - neug::Status writeTable(const QueryResponse* table) override; + Status writeTable(const QueryResponse* table) override; private: std::shared_ptr fileSystem_; diff --git a/extension/parquet/include/parquet_read_function.h b/extension/parquet/include/parquet_read_function.h index 43177547b..56d4ca187 100644 --- a/extension/parquet/include/parquet_read_function.h +++ b/extension/parquet/include/parquet_read_function.h @@ -47,7 +47,7 @@ struct ParquetReadFunction { static execution::Context execFunc( std::shared_ptr state) { - const auto& vfs = neug::main::MetadataRegistry::getVFS(); + const auto& vfs = main::MetadataRegistry::getVFS(); const auto& fs = vfs->Provide(state->schema.file); auto resolvedPaths = std::vector(); for (const auto& path : state->schema.file.paths) { @@ -80,7 +80,7 @@ struct ParquetReadFunction { externalSchema.file.options["BATCH_SIZE"] = std::to_string(reader::kSniffBlockSize); - const auto& vfs = neug::main::MetadataRegistry::getVFS(); + const auto& vfs = main::MetadataRegistry::getVFS(); const auto& fs = vfs->Provide(state->schema.file); auto resolvedPaths = std::vector(); for (const auto& path : state->schema.file.paths) { diff --git a/extension/parquet/src/arrow_context_column.cc b/extension/parquet/src/arrow_column.cc similarity index 95% rename from extension/parquet/src/arrow_context_column.cc rename to extension/parquet/src/arrow_column.cc index 618a4763d..873e5adbb 100644 --- a/extension/parquet/src/arrow_context_column.cc +++ b/extension/parquet/src/arrow_column.cc @@ -13,16 +13,15 @@ * limitations under the License. */ -#include "parquet/arrow_context_column.h" +#include "parquet/arrow_column.h" #include #include -#include "neug/execution/common/columns/value_columns.h" +#include "neug/common/columns/value_columns.h" #include "neug/utils/exception/exception.h" namespace neug { -namespace execution { /// Convert numeric arrow arrays directly to ValueColumn. template @@ -64,7 +63,7 @@ static std::shared_ptr convert_string_arrays( /// Convert date32 arrow arrays (days since epoch) to ValueColumn. static std::shared_ptr convert_date32_arrays( const std::vector>& arrays) { - ValueColumnBuilder builder; + ValueColumnBuilder builder; for (const auto& arr : arrays) { auto typed = std::static_pointer_cast(arr); for (int64_t j = 0; j < typed->length(); ++j) { @@ -83,7 +82,7 @@ static std::shared_ptr convert_date32_arrays( /// Convert date64 arrow arrays (ms since epoch) to ValueColumn. static std::shared_ptr convert_date64_arrays( const std::vector>& arrays) { - ValueColumnBuilder builder; + ValueColumnBuilder builder; for (const auto& arr : arrays) { auto typed = std::static_pointer_cast(arr); for (int64_t j = 0; j < typed->length(); ++j) { @@ -100,7 +99,7 @@ static std::shared_ptr convert_date64_arrays( /// Convert timestamp arrow arrays to ValueColumn. static std::shared_ptr convert_timestamp_arrays( const std::vector>& arrays) { - ValueColumnBuilder builder; + ValueColumnBuilder builder; for (const auto& arr : arrays) { auto typed = std::static_pointer_cast(arr); for (int64_t j = 0; j < typed->length(); ++j) { @@ -168,5 +167,4 @@ std::shared_ptr recordbatch_to_value_datachunk( return chunk; } -} // namespace execution } // namespace neug diff --git a/extension/parquet/src/arrow_reader.cc b/extension/parquet/src/arrow_reader.cc index b82ea6c7b..dd3e77fbe 100644 --- a/extension/parquet/src/arrow_reader.cc +++ b/extension/parquet/src/arrow_reader.cc @@ -19,7 +19,7 @@ #include #include -#include "parquet/arrow_context_column.h" +#include "parquet/arrow_column.h" #include "parquet/arrow_reader.h" #include "parquet/record_batch_supplier.h" @@ -163,11 +163,10 @@ void ArrowReader::full_read(std::shared_ptr scanner, } output.clear(); - execution::DataChunk chunk; + DataChunk chunk; for (int i = 0; i < num_cols; ++i) { auto table_column = table->column(i); - chunk.set(i, - execution::arrow_arrays_to_value_column(table_column->chunks())); + chunk.set(i, arrow_arrays_to_value_column(table_column->chunks())); } output.append_chunk(std::move(chunk)); } @@ -212,17 +211,17 @@ void ArrowReader::batch_read(std::shared_ptr scanner, arrow::Result> ArrowReader::inferSchema() { if (!sharedState) { - return arrow::Status::Invalid(neug::StatusCode::ERR_INVALID_ARGUMENT, + return arrow::Status::Invalid(StatusCode::ERR_INVALID_ARGUMENT, "SharedState is null"); } if (!fileSystem) { - return arrow::Status::Invalid(neug::StatusCode::ERR_INVALID_ARGUMENT, + return arrow::Status::Invalid(StatusCode::ERR_INVALID_ARGUMENT, "FileSystem is null"); } if (!optionsBuilder) { - return arrow::Status::Invalid(neug::StatusCode::ERR_INVALID_ARGUMENT, + return arrow::Status::Invalid(StatusCode::ERR_INVALID_ARGUMENT, "Options builder is null"); } diff --git a/extension/parquet/src/arrow_sniffer.cc b/extension/parquet/src/arrow_sniffer.cc index 779d79bc9..e836d3e3c 100644 --- a/extension/parquet/src/arrow_sniffer.cc +++ b/extension/parquet/src/arrow_sniffer.cc @@ -27,13 +27,13 @@ namespace reader { result> ArrowSniffer::sniff() { if (!reader_) { - RETURN_STATUS_ERROR(neug::StatusCode::ERR_INVALID_ARGUMENT, + RETURN_STATUS_ERROR(StatusCode::ERR_INVALID_ARGUMENT, "ArrowReader is null"); } auto arrowSchema = reader_->inferSchema(); if (!arrowSchema.ok()) { - RETURN_STATUS_ERROR(neug::StatusCode::ERR_IO_ERROR, + RETURN_STATUS_ERROR(StatusCode::ERR_IO_ERROR, "Failed to infer schema from ArrowReader: " + arrowSchema.status().ToString()); } @@ -45,7 +45,7 @@ result> ArrowSniffer::convertArrowSchemaToEntrySchema( const std::shared_ptr& arrowSchema) { if (!arrowSchema) { - RETURN_STATUS_ERROR(neug::StatusCode::ERR_INVALID_ARGUMENT, + RETURN_STATUS_ERROR(StatusCode::ERR_INVALID_ARGUMENT, "Arrow schema is null"); } @@ -65,7 +65,7 @@ ArrowSniffer::convertArrowSchemaToEntrySchema( auto commonType = converter.convert(*field->type()); if (!commonType) { RETURN_STATUS_ERROR( - neug::StatusCode::ERR_TYPE_CONVERSION, + StatusCode::ERR_TYPE_CONVERSION, "Failed to convert Arrow type for column: " + columnName); } entrySchema->columnTypes.push_back(std::move(commonType)); diff --git a/extension/parquet/src/parquet_export_function.cc b/extension/parquet/src/parquet_export_function.cc index ce770c789..de2ba70ad 100644 --- a/extension/parquet/src/parquet_export_function.cc +++ b/extension/parquet/src/parquet_export_function.cc @@ -360,9 +360,9 @@ static std::shared_ptr protoArrayToArrowArray( } } -neug::Status ArrowParquetExportWriter::writeTable(const QueryResponse* table) { +Status ArrowParquetExportWriter::writeTable(const QueryResponse* table) { if (!table || table->row_count() == 0) { - return neug::Status::OK(); + return Status::OK(); } try { @@ -395,9 +395,8 @@ neug::Status ArrowParquetExportWriter::writeTable(const QueryResponse* table) { // 2. Open output file auto result = fileSystem_->OpenOutputStream(schema_.paths[0]); if (!result.ok()) { - return neug::Status( - neug::StatusCode::ERR_IO_ERROR, - "Failed to open output file: " + result.status().ToString()); + return Status(StatusCode::ERR_IO_ERROR, "Failed to open output file: " + + result.status().ToString()); } auto outfile = result.ValueOrDie(); @@ -407,9 +406,9 @@ neug::Status ArrowParquetExportWriter::writeTable(const QueryResponse* table) { auto writer_result = ::parquet::arrow::FileWriter::Open( *arrow_schema, arrow::default_memory_pool(), outfile, properties); if (!writer_result.ok()) { - return neug::Status(neug::StatusCode::ERR_IO_ERROR, - "Failed to create Parquet writer: " + - writer_result.status().ToString()); + return Status(StatusCode::ERR_IO_ERROR, + "Failed to create Parquet writer: " + + writer_result.status().ToString()); } auto writer = std::move(writer_result.ValueOrDie()); @@ -429,32 +428,31 @@ neug::Status ArrowParquetExportWriter::writeTable(const QueryResponse* table) { auto write_status = writer->WriteTable(*arrow_table, arrow_table->num_rows()); if (!write_status.ok()) { - return neug::Status( - neug::StatusCode::ERR_IO_ERROR, + return Status( + StatusCode::ERR_IO_ERROR, "Failed to write Parquet table: " + write_status.ToString()); } // 6. Close writer to flush and write footer auto close_status = writer->Close(); if (!close_status.ok()) { - return neug::Status( - neug::StatusCode::ERR_IO_ERROR, + return Status( + StatusCode::ERR_IO_ERROR, "Failed to close Parquet writer: " + close_status.ToString()); } // 7. Close output stream auto outfile_close_status = outfile->Close(); if (!outfile_close_status.ok()) { - return neug::Status( - neug::StatusCode::ERR_IO_ERROR, + return Status( + StatusCode::ERR_IO_ERROR, "Failed to close output stream: " + outfile_close_status.ToString()); } - return neug::Status::OK(); + return Status::OK(); } catch (const std::exception& e) { - return neug::Status( - neug::StatusCode::ERR_IO_ERROR, - std::string("Failed to write Parquet table: ") + e.what()); + return Status(StatusCode::ERR_IO_ERROR, + std::string("Failed to write Parquet table: ") + e.what()); } } @@ -464,18 +462,18 @@ namespace function { // Export function execution static execution::Context parquetExecFunc( - neug::execution::Context& ctx, reader::FileSchema& schema, + execution::Context& ctx, reader::FileSchema& schema, const std::shared_ptr& entry_schema, - const neug::StorageReadInterface& graph) { + const StorageReadInterface& graph) { if (schema.paths.empty()) { THROW_INVALID_ARGUMENT_EXCEPTION("Schema paths is empty"); } - const auto& vfs = neug::main::MetadataRegistry::getVFS(); + const auto& vfs = main::MetadataRegistry::getVFS(); const auto& fs = vfs->Provide(schema); - auto arrowFs = neug::parquet::resolveArrowFileSystem(*fs); - auto writer = std::make_shared( + auto arrowFs = parquet::resolveArrowFileSystem(*fs); + auto writer = std::make_shared( schema, std::move(arrowFs), entry_schema); auto status = writer->write(ctx, graph); diff --git a/extension/parquet/src/record_batch_supplier.cc b/extension/parquet/src/record_batch_supplier.cc index ea14d0af7..67be363a4 100644 --- a/extension/parquet/src/record_batch_supplier.cc +++ b/extension/parquet/src/record_batch_supplier.cc @@ -19,19 +19,19 @@ #include #include -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" #include "neug/utils/exception/exception.h" -#include "parquet/arrow_context_column.h" +#include "parquet/arrow_column.h" namespace neug { -std::shared_ptr RecordBatchChunkSupplier::GetNextChunk() { +std::shared_ptr RecordBatchChunkSupplier::GetNextChunk() { if (!reader_) { THROW_IO_EXCEPTION("Reader is null"); } auto result = reader_->Next(); if (result.ok()) { - return execution::recordbatch_to_value_datachunk(result.ValueOrDie()); + return recordbatch_to_value_datachunk(result.ValueOrDie()); } LOG(ERROR) << "Failed to get next batch: " << result.status().message(); THROW_IO_EXCEPTION("Failed to get next batch: " + result.status().message()); diff --git a/extension/parquet/tests/parquet_test.cc b/extension/parquet/tests/parquet_test.cc index 0592316cd..334b4b695 100644 --- a/extension/parquet/tests/parquet_test.cc +++ b/extension/parquet/tests/parquet_test.cc @@ -31,7 +31,7 @@ #include "neug/utils/exception/exception.h" #include "neug/utils/io/read/common/options.h" #include "neug/utils/io/read/common/schema.h" -#include "parquet/arrow_context_column.h" +#include "parquet/arrow_column.h" #include "parquet/arrow_reader.h" #include "../../extension/parquet/include/parquet_export_function.h" @@ -458,8 +458,8 @@ TEST_F(ParquetTest, TestTypeMapping_StringToLargeUtf8) { // Verify string column type auto col1 = ctx.chunk(0).columns()[1]; - ASSERT_EQ(col1->column_type(), execution::ContextColumnType::kValue); - EXPECT_EQ(col1->elem_type().id(), neug::DataTypeId::kVarchar); + ASSERT_EQ(col1->column_type(), ContextColumnType::kValue); + EXPECT_EQ(col1->elem_type().id(), DataTypeId::kVarchar); } TEST_F(ParquetTest, TestTypeMapping_PreserveNumericTypes) { @@ -512,14 +512,10 @@ TEST_F(ParquetTest, TestTypeMapping_PreserveNumericTypes) { EXPECT_EQ(ctx.row_num(), 1); // Verify types are preserved correctly - EXPECT_EQ(ctx.chunk(0).columns()[0]->elem_type().id(), - neug::DataTypeId::kInt32); - EXPECT_EQ(ctx.chunk(0).columns()[1]->elem_type().id(), - neug::DataTypeId::kInt64); - EXPECT_EQ(ctx.chunk(0).columns()[2]->elem_type().id(), - neug::DataTypeId::kDouble); - EXPECT_EQ(ctx.chunk(0).columns()[3]->elem_type().id(), - neug::DataTypeId::kBoolean); + EXPECT_EQ(ctx.chunk(0).columns()[0]->elem_type().id(), DataTypeId::kInt32); + EXPECT_EQ(ctx.chunk(0).columns()[1]->elem_type().id(), DataTypeId::kInt64); + EXPECT_EQ(ctx.chunk(0).columns()[2]->elem_type().id(), DataTypeId::kDouble); + EXPECT_EQ(ctx.chunk(0).columns()[3]->elem_type().id(), DataTypeId::kBoolean); } // ============================================================================= @@ -704,7 +700,7 @@ TEST_F(ParquetTest, TestIntegration_BatchReadMode) { reader2->read(localState2, ctx2); auto col0_2 = ctx2.chunk(0).columns()[0]; - EXPECT_EQ(col0_2->column_type(), execution::ContextColumnType::kValue) + EXPECT_EQ(col0_2->column_type(), ContextColumnType::kValue) << "Extension should use Value column type when batch_read=false"; } @@ -1010,7 +1006,7 @@ TEST_F(ParquetTest, TestMultiFile_ExplicitPaths) { TEST_F(ParquetTest, TestParquetExportWriter) { // Create a QueryResponse with test data - neug::QueryResponse response; + QueryResponse response; response.set_row_count(3); // Add schema @@ -1055,8 +1051,8 @@ TEST_F(ParquetTest, TestParquetExportWriter) { // Create ArrowParquetExportWriter auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); // Write the response auto status = writer.writeTable(&response); @@ -1082,7 +1078,7 @@ TEST_F(ParquetTest, TestParquetExportWriter) { TEST_F(ParquetTest, TestParquetExportWithNulls) { // Test export with NULL values - neug::QueryResponse response; + QueryResponse response; response.set_row_count(3); auto* schema = response.mutable_schema(); @@ -1117,8 +1113,8 @@ TEST_F(ParquetTest, TestParquetExportWithNulls) { file_schema.format = "parquet"; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with nulls: " @@ -1142,7 +1138,7 @@ TEST_F(ParquetTest, TestParquetExportWithNulls) { TEST_F(ParquetTest, TestParquetExportMultipleTypes) { // Test export with various data types - neug::QueryResponse response; + QueryResponse response; response.set_row_count(2); auto* schema = response.mutable_schema(); @@ -1203,8 +1199,8 @@ TEST_F(ParquetTest, TestParquetExportMultipleTypes) { file_schema.format = "parquet"; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with multiple types: " @@ -1215,7 +1211,7 @@ TEST_F(ParquetTest, TestParquetExportMultipleTypes) { TEST_F(ParquetTest, TestParquetExportLargeDataset) { // Test export with larger dataset to verify no OOM - neug::QueryResponse response; + QueryResponse response; const int num_rows = 10000; response.set_row_count(num_rows); @@ -1248,8 +1244,8 @@ TEST_F(ParquetTest, TestParquetExportLargeDataset) { file_schema.format = "parquet"; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write large Parquet: " @@ -1265,7 +1261,7 @@ TEST_F(ParquetTest, TestParquetExportLargeDataset) { TEST_F(ParquetTest, TestParquetExportWithCompressionOptions) { // Test export with different compression settings - neug::QueryResponse response; + QueryResponse response; response.set_row_count(100); auto* schema = response.mutable_schema(); @@ -1301,8 +1297,8 @@ TEST_F(ParquetTest, TestParquetExportWithCompressionOptions) { file_schema_zstd.options = {{"compression", "zstd"}}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer_zstd(file_schema_zstd, - file_system, entry_schema); + writer::ArrowParquetExportWriter writer_zstd(file_schema_zstd, file_system, + entry_schema); auto status = writer_zstd.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write ZSTD Parquet: " @@ -1317,8 +1313,8 @@ TEST_F(ParquetTest, TestParquetExportWithCompressionOptions) { file_schema_none.format = "parquet"; file_schema_none.options = {{"compression", "none"}}; - neug::writer::ArrowParquetExportWriter writer_none(file_schema_none, - file_system, entry_schema); + writer::ArrowParquetExportWriter writer_none(file_schema_none, file_system, + entry_schema); status = writer_none.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write uncompressed Parquet: " @@ -1355,7 +1351,7 @@ TEST_F(ParquetTest, TestParquetExportWithCompressionOptions) { TEST_F(ParquetTest, TestParquetExportWithUnsupportedCompression) { // Test that unsupported compression codecs produce a clear error - neug::QueryResponse response; + QueryResponse response; response.set_row_count(3); auto* schema = response.mutable_schema(); @@ -1379,8 +1375,8 @@ TEST_F(ParquetTest, TestParquetExportWithUnsupportedCompression) { file_schema.options = {{"compression", "lz4"}}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); // Should fail due to unsupported codec auto status = writer.writeTable(&response); @@ -1390,7 +1386,7 @@ TEST_F(ParquetTest, TestParquetExportWithUnsupportedCompression) { TEST_F(ParquetTest, TestParquetExportWithRowGroupSize) { // Test export with custom row group size - neug::QueryResponse response; + QueryResponse response; response.set_row_count(100); auto* schema = response.mutable_schema(); @@ -1416,8 +1412,8 @@ TEST_F(ParquetTest, TestParquetExportWithRowGroupSize) { {"row_group_size", "5000"}}; // Use valid value >= 1024 auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with row_group_size: " @@ -1438,7 +1434,7 @@ TEST_F(ParquetTest, TestParquetExportWithRowGroupSize) { TEST_F(ParquetTest, TestParquetExportWithDictionaryEncoding) { // Test export with dictionary encoding disabled - neug::QueryResponse response; + QueryResponse response; const int num_rows = 10000; // Larger dataset to show dictionary encoding benefits response.set_row_count(num_rows); @@ -1486,8 +1482,8 @@ TEST_F(ParquetTest, TestParquetExportWithDictionaryEncoding) { {"compression", "none"}}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer_dict(file_schema_dict, - file_system, entry_schema); + writer::ArrowParquetExportWriter writer_dict(file_schema_dict, file_system, + entry_schema); auto status = writer_dict.writeTable(&response); ASSERT_TRUE(status.ok()) @@ -1504,8 +1500,8 @@ TEST_F(ParquetTest, TestParquetExportWithDictionaryEncoding) { file_schema_nodict.options = {{"dictionary_encoding", "false"}, {"compression", "none"}}; - neug::writer::ArrowParquetExportWriter writer_nodict( - file_schema_nodict, file_system, entry_schema); + writer::ArrowParquetExportWriter writer_nodict(file_schema_nodict, + file_system, entry_schema); status = writer_nodict.writeTable(&response); ASSERT_TRUE(status.ok()) @@ -1546,7 +1542,7 @@ TEST_F(ParquetTest, TestParquetExportWithDictionaryEncoding) { TEST_F(ParquetTest, TestParquetExportWithDateAndTimestamp) { // Test export with date and timestamp types - neug::QueryResponse response; + QueryResponse response; const int num_rows = 100; response.set_row_count(num_rows); @@ -1595,8 +1591,8 @@ TEST_F(ParquetTest, TestParquetExportWithDateAndTimestamp) { createTimestampType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with date/timestamp: " @@ -1618,7 +1614,7 @@ TEST_F(ParquetTest, TestParquetExportWithDateAndTimestamp) { TEST_F(ParquetTest, TestParquetExportWithListType) { // Test export with list/array type - neug::QueryResponse response; + QueryResponse response; const int num_rows = 10; response.set_row_count(num_rows); @@ -1671,8 +1667,8 @@ TEST_F(ParquetTest, TestParquetExportWithListType) { createStringType()}; // List auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with list type: " @@ -1685,7 +1681,7 @@ TEST_F(ParquetTest, TestParquetExportWithListType) { TEST_F(ParquetTest, TestParquetExportWithListOfStrings) { // Test export with list type - neug::QueryResponse response; + QueryResponse response; const int num_rows = 5; response.set_row_count(num_rows); @@ -1747,8 +1743,8 @@ TEST_F(ParquetTest, TestParquetExportWithListOfStrings) { entry_schema->columnTypes = {createStringType(), createStringType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with list: " @@ -1762,7 +1758,7 @@ TEST_F(ParquetTest, TestParquetExportWithListOfStrings) { TEST_F(ParquetTest, TestParquetExportWithStructType) { // Test export with struct type - neug::QueryResponse response; + QueryResponse response; const int num_rows = 5; response.set_row_count(num_rows); @@ -1815,8 +1811,8 @@ TEST_F(ParquetTest, TestParquetExportWithStructType) { entry_schema->columnTypes = {createInt64Type(), createStringType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with struct type: " @@ -1830,7 +1826,7 @@ TEST_F(ParquetTest, TestParquetExportWithStructType) { TEST_F(ParquetTest, TestParquetExportWithVertexType) { // Test export with vertex type (JSON string parsed to struct) - neug::QueryResponse response; + QueryResponse response; const int num_rows = 3; response.set_row_count(num_rows); @@ -1870,8 +1866,8 @@ TEST_F(ParquetTest, TestParquetExportWithVertexType) { entry_schema->columnTypes = {createInt64Type(), createStringType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with vertex type: " @@ -1885,7 +1881,7 @@ TEST_F(ParquetTest, TestParquetExportWithVertexType) { TEST_F(ParquetTest, TestParquetExportWithEdgeType) { // Test export with edge type (JSON string parsed to struct) - neug::QueryResponse response; + QueryResponse response; const int num_rows = 3; response.set_row_count(num_rows); @@ -1925,8 +1921,8 @@ TEST_F(ParquetTest, TestParquetExportWithEdgeType) { entry_schema->columnTypes = {createInt64Type(), createStringType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with edge type: " @@ -1940,7 +1936,7 @@ TEST_F(ParquetTest, TestParquetExportWithEdgeType) { TEST_F(ParquetTest, TestParquetExportWithPathType) { // Test export with path type (JSON string parsed to struct) - neug::QueryResponse response; + QueryResponse response; const int num_rows = 2; response.set_row_count(num_rows); @@ -1977,8 +1973,8 @@ TEST_F(ParquetTest, TestParquetExportWithPathType) { entry_schema->columnTypes = {createInt64Type(), createStringType()}; auto file_system = std::make_shared(); - neug::writer::ArrowParquetExportWriter writer(file_schema, file_system, - entry_schema); + writer::ArrowParquetExportWriter writer(file_schema, file_system, + entry_schema); auto status = writer.writeTable(&response); ASSERT_TRUE(status.ok()) << "Failed to write Parquet with path type: " diff --git a/include/neug/execution/common/columns/columns_utils.h b/include/neug/common/columns/columns_utils.h similarity index 94% rename from include/neug/execution/common/columns/columns_utils.h rename to include/neug/common/columns/columns_utils.h index 719e353f9..c4291bedb 100644 --- a/include/neug/execution/common/columns/columns_utils.h +++ b/include/neug/common/columns/columns_utils.h @@ -18,10 +18,9 @@ #include #include #include -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" namespace neug { -namespace execution { class ColumnsUtils { public: template @@ -55,5 +54,4 @@ class ColumnsUtils { static std::shared_ptr create_builder( const DataType& type); }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/columns/edge_columns.h b/include/neug/common/columns/edge_columns.h similarity index 99% rename from include/neug/execution/common/columns/edge_columns.h rename to include/neug/common/columns/edge_columns.h index 542434e6a..cf7428e9a 100644 --- a/include/neug/execution/common/columns/edge_columns.h +++ b/include/neug/common/columns/edge_columns.h @@ -14,16 +14,14 @@ */ #pragma once -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/columns/i_context_column.h" -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/types/graph_types.h" +#include "neug/common/types/i_context_column.h" #include "neug/utils/property/column.h" #include "neug/utils/property/types.h" namespace neug { -namespace execution { - enum class EdgeColumnType { kSDSL, kSDML, kBDSL, kBDML, kMS, kUnKnown }; class IEdgeColumn : public IContextColumn { @@ -885,6 +883,4 @@ void foreach_edge( } } -} // namespace execution - } // namespace neug diff --git a/include/neug/execution/common/columns/list_columns.h b/include/neug/common/columns/list_columns.h similarity index 97% rename from include/neug/execution/common/columns/list_columns.h rename to include/neug/common/columns/list_columns.h index f24fefbba..0f62e3793 100644 --- a/include/neug/execution/common/columns/list_columns.h +++ b/include/neug/common/columns/list_columns.h @@ -14,10 +14,9 @@ */ #pragma once -#include "neug/execution/common/columns/value_columns.h" +#include "neug/common/columns/value_columns.h" namespace neug { -namespace execution { struct list_item { uint64_t offset; @@ -145,5 +144,4 @@ class ListColumnBuilder : public IContextColumnBuilder { std::shared_ptr child_builder_; }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/columns/path_columns.h b/include/neug/common/columns/path_columns.h similarity index 94% rename from include/neug/execution/common/columns/path_columns.h rename to include/neug/common/columns/path_columns.h index 199e92504..90a5aab2f 100644 --- a/include/neug/execution/common/columns/path_columns.h +++ b/include/neug/common/columns/path_columns.h @@ -14,11 +14,10 @@ */ #pragma once -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/types/i_context_column.h" namespace neug { -namespace execution { class PathColumnBuilder; @@ -104,5 +103,4 @@ class PathColumnBuilder : public IContextColumnBuilder { vector_t data_; }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/columns/struct_columns.h b/include/neug/common/columns/struct_columns.h similarity index 95% rename from include/neug/execution/common/columns/struct_columns.h rename to include/neug/common/columns/struct_columns.h index 3047ab637..49773f565 100644 --- a/include/neug/execution/common/columns/struct_columns.h +++ b/include/neug/common/columns/struct_columns.h @@ -14,10 +14,9 @@ */ #pragma once -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" namespace neug { -namespace execution { class StructColumnBuilder; class StructColumn : public IContextColumn { @@ -96,5 +95,4 @@ class StructColumnBuilder : public IContextColumnBuilder { std::vector> child_builders_; }; -} // namespace execution } // namespace neug \ No newline at end of file diff --git a/include/neug/execution/common/columns/value_columns.h b/include/neug/common/columns/value_columns.h similarity index 98% rename from include/neug/execution/common/columns/value_columns.h rename to include/neug/common/columns/value_columns.h index ba94728bb..f575737d8 100644 --- a/include/neug/execution/common/columns/value_columns.h +++ b/include/neug/common/columns/value_columns.h @@ -14,14 +14,12 @@ */ #pragma once -#include "neug/execution/common/columns/columns_utils.h" +#include "neug/common/columns/columns_utils.h" #include "neug/utils/property/types.h" #include "neug/utils/top_n_generator.h" namespace neug { -namespace execution { - template class ValueColumnBuilder; @@ -263,6 +261,4 @@ bool ValueColumn::order_by_limit(bool asc, size_t limit, return true; } -} // namespace execution - } // namespace neug diff --git a/include/neug/execution/common/columns/vertex_columns.h b/include/neug/common/columns/vertex_columns.h similarity index 99% rename from include/neug/execution/common/columns/vertex_columns.h rename to include/neug/common/columns/vertex_columns.h index ad734e613..07e95aba0 100644 --- a/include/neug/execution/common/columns/vertex_columns.h +++ b/include/neug/common/columns/vertex_columns.h @@ -14,12 +14,10 @@ */ #pragma once -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" namespace neug { -namespace execution { - enum class VertexColumnType { kSingle, kMultiSegment, @@ -468,6 +466,4 @@ void foreach_vertex(const IVertexColumn& col, const FUNC_T& func) { } } -} // namespace execution - } // namespace neug diff --git a/include/neug/execution/utils/numeric_cast.h b/include/neug/common/numeric_cast.h similarity index 99% rename from include/neug/execution/utils/numeric_cast.h rename to include/neug/common/numeric_cast.h index 91626184f..606de1066 100644 --- a/include/neug/execution/utils/numeric_cast.h +++ b/include/neug/common/numeric_cast.h @@ -29,7 +29,6 @@ #include "fast_float.h" namespace neug { -namespace execution { inline std::pair removeWhiteSpaces(std::string_view sw) { // skip leading/trailing spaces @@ -491,6 +490,5 @@ struct NumericCast { return result; } }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/columns/array_columns.h b/include/neug/common/types/array_columns.h similarity index 96% rename from include/neug/execution/common/columns/array_columns.h rename to include/neug/common/types/array_columns.h index 43b925ed8..355dd1933 100644 --- a/include/neug/execution/common/columns/array_columns.h +++ b/include/neug/common/types/array_columns.h @@ -14,13 +14,13 @@ */ #pragma once +#include "neug/common/columns/columns_utils.h" #include "neug/common/extra_type_info.h" -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" +#include "neug/common/types/value.h" #include "neug/utils/exception/exception.h" namespace neug { -namespace execution { class ArrayColumnBuilder; @@ -135,5 +135,4 @@ class ArrayColumnBuilder : public IContextColumnBuilder { std::shared_ptr child_builder_; }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/columns/container_types.h b/include/neug/common/types/container_types.h similarity index 100% rename from include/neug/execution/common/columns/container_types.h rename to include/neug/common/types/container_types.h diff --git a/include/neug/execution/common/data_chunk.h b/include/neug/common/types/data_chunk.h similarity index 95% rename from include/neug/execution/common/data_chunk.h rename to include/neug/common/types/data_chunk.h index b53f1938d..bc1b83a4e 100644 --- a/include/neug/execution/common/data_chunk.h +++ b/include/neug/common/types/data_chunk.h @@ -20,14 +20,12 @@ #include #include -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" #include "neug/utils/exception/exception.h" namespace neug { class StorageReadInterface; -namespace execution { - /** * @brief A DataChunk holds a set of columns that share the same row count. * @@ -75,5 +73,4 @@ class DataChunk { std::vector> columns; }; -} // namespace execution } // namespace neug diff --git a/include/neug/execution/common/types/graph_types.h b/include/neug/common/types/graph_types.h similarity index 93% rename from include/neug/execution/common/types/graph_types.h rename to include/neug/common/types/graph_types.h index c873417b1..8d69731d8 100644 --- a/include/neug/execution/common/types/graph_types.h +++ b/include/neug/common/types/graph_types.h @@ -27,8 +27,6 @@ namespace neug { -namespace execution { - int64_t encode_unique_vertex_id(label_t label_id, vid_t vid); std::pair decode_unique_vertex_id(uint64_t unique_id); uint32_t generate_edge_label_id(label_t src_label_id, label_t dst_label_id, @@ -195,8 +193,6 @@ struct Path { std::shared_ptr impl_; }; -} // namespace execution - } // namespace neug namespace std { @@ -207,14 +203,14 @@ static inline void hash_combine(std::size_t& seed, const T& val) { seed ^= hasher(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } template <> -struct hash { +struct hash { // Hash combine functions copied from Boost.ContainerHash // https://github.com/boostorg/container_hash/blob/171c012d4723c5e93cc7cffe42919afdf8b27dfa/include/boost/container_hash/hash.hpp#L311 // that is based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf // issue 6.18. - size_t operator()(const neug::execution::VertexRecord& record) const { + size_t operator()(const neug::VertexRecord& record) const { std::size_t seed = 0; hash_combine(seed, record.vid_); hash_combine(seed, record.label_); @@ -222,8 +218,7 @@ struct hash { } std::size_t operator()( - const std::pair& p) const { + const std::pair& p) const { std::size_t seed = 0; hash_combine(seed, p.first.vid_); hash_combine(seed, p.first.label_); @@ -241,8 +236,8 @@ struct hash { }; template <> -struct hash { - size_t operator()(const neug::execution::LabelTriplet& lt) const { +struct hash { + size_t operator()(const neug::LabelTriplet& lt) const { size_t seed = 0; hash_combine(seed, lt.src_label); hash_combine(seed, lt.dst_label); diff --git a/include/neug/execution/common/columns/i_context_column.h b/include/neug/common/types/i_context_column.h similarity index 95% rename from include/neug/execution/common/columns/i_context_column.h rename to include/neug/common/types/i_context_column.h index 6a1c33c33..12bf09bec 100644 --- a/include/neug/execution/common/columns/i_context_column.h +++ b/include/neug/common/types/i_context_column.h @@ -19,16 +19,14 @@ #include #include -#include "neug/execution/common/columns/container_types.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/container_types.h" +#include "neug/common/types/value.h" #include "glog/logging.h" #include "neug/utils/property/types.h" namespace neug { -namespace execution { - enum class ContextColumnType { kVertex, kEdge, @@ -111,6 +109,4 @@ class IContextColumnBuilder { virtual std::shared_ptr finish() = 0; }; -} // namespace execution - } // namespace neug diff --git a/include/neug/execution/common/types/value.h b/include/neug/common/types/value.h similarity index 92% rename from include/neug/execution/common/types/value.h rename to include/neug/common/types/value.h index c105ebabf..0d2a86945 100644 --- a/include/neug/execution/common/types/value.h +++ b/include/neug/common/types/value.h @@ -24,9 +24,9 @@ #include #include #include +#include "neug/common/numeric_cast.h" #include "neug/common/types.h" -#include "neug/execution/common/types/graph_types.h" -#include "neug/execution/utils/numeric_cast.h" +#include "neug/common/types/graph_types.h" namespace neug { class Encoder; @@ -34,12 +34,12 @@ class InArchive; class OutArchive; struct EmptyType; -namespace execution { -using timestamp_ms_t = neug::DateTime; -using interval_t = neug::Interval; -using date_t = neug::Date; -using vertex_t = neug::execution::VertexRecord; -using edge_t = neug::execution::EdgeRecord; +using date_t = Date; +using timestamp_ms_t = DateTime; +using interval_t = Interval; +using vertex_t = VertexRecord; +using edge_t = EdgeRecord; + struct ExtraValueInfo; class Value { friend struct StringValue; @@ -279,11 +279,11 @@ struct ValueConverter { template static bool cast(const T& input, int32_t& output) { if constexpr (std::is_same_v) { - auto [data, len] = neug::execution::removeWhiteSpaces(input); + auto [data, len] = removeWhiteSpaces(input); auto [ptr, ec] = std::from_chars(data, data + len, output); return ec == std::errc() && ptr == data + len; } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -308,11 +308,11 @@ struct ValueConverter { output = input.to_mill_seconds(); return true; } else if constexpr (std::is_same_v) { - auto [data, len] = neug::execution::removeWhiteSpaces(input); + auto [data, len] = removeWhiteSpaces(input); auto [ptr, ec] = std::from_chars(data, data + len, output); return ec == std::errc() && ptr == data + len; } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -327,11 +327,11 @@ struct ValueConverter { template static bool cast(const T& input, uint32_t& output) { if constexpr (std::is_same_v) { - auto [data, len] = neug::execution::removeWhiteSpaces(input); + auto [data, len] = removeWhiteSpaces(input); auto [ptr, ec] = std::from_chars(data, data + len, output); return ec == std::errc() && ptr == data + len; } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -346,11 +346,11 @@ struct ValueConverter { template static bool cast(const T& input, uint64_t& output) { if constexpr (std::is_same_v) { - auto [data, len] = neug::execution::removeWhiteSpaces(input); + auto [data, len] = removeWhiteSpaces(input); auto [ptr, ec] = std::from_chars(data, data + len, output); return ec == std::errc() && ptr == data + len; } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -373,9 +373,9 @@ struct ValueConverter { template static bool cast(const T& input, double& output) { if constexpr (std::is_same_v) { - return neug::execution::tryDoubleCast(input, output); + return tryDoubleCast(input, output); } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -390,9 +390,9 @@ struct ValueConverter { template static bool cast(const T& input, float& output) { if constexpr (std::is_same_v) { - return neug::execution::tryDoubleCast(input, output); + return tryDoubleCast(input, output); } else { - return neug::execution::TryCastWithOverflowCheck(input, output); + return TryCastWithOverflowCheck(input, output); } } }; @@ -706,7 +706,7 @@ Value performCast(const Value& input) { template <> inline Value performCast(const Value& input) { - neug::DateTime val; + DateTime val; bool ret = false; if (input.type().id() == DataTypeId::kVarchar) { ret = ValueConverter::cast(StringValue::Get(input), val); @@ -725,20 +725,19 @@ inline Value performCast(const Value& input) { } template <> -inline Value performCast(const Value& input) { - neug::Date val; +inline Value performCast(const Value& input) { + Date val; bool ret = false; if (input.type().id() == DataTypeId::kVarchar) { - ret = ValueConverter::cast(StringValue::Get(input), val); + ret = ValueConverter::cast(StringValue::Get(input), val); } else if (input.type().id() == DataTypeId::kTimestampMs) { - ret = - ValueConverter::cast(input.GetValue(), val); + ret = ValueConverter::cast(input.GetValue(), val); } else { THROW_CONVERSION_EXCEPTION( "Only string type is supported for casting to Date."); } if (ret) { - return Value::CreateValue(val); + return Value::CreateValue(val); } else { THROW_CONVERSION_EXCEPTION("Failed to cast value to Date."); } @@ -749,9 +748,7 @@ Value performCastToString(const Value& input); void encode_value(const Value& val, Encoder& encoder); -} // namespace execution - -InArchive& operator<<(InArchive& in_archive, const execution::Value& value); -OutArchive& operator>>(OutArchive& out_archive, execution::Value& value); +InArchive& operator<<(InArchive& in_archive, const neug::Value& value); +OutArchive& operator>>(OutArchive& out_archive, neug::Value& value); } // namespace neug diff --git a/include/neug/compiler/binder/binder.h b/include/neug/compiler/binder/binder.h index 06e74763a..0b21b8a4a 100644 --- a/include/neug/compiler/binder/binder.h +++ b/include/neug/compiler/binder/binder.h @@ -102,12 +102,12 @@ class Binder { std::unique_ptr bind(const parser::Statement& statement); void setInputParameters( - std::unordered_map> + std::unordered_map> parameters) { expressionBinder.parameterMap = std::move(parameters); } - std::unordered_map> + std::unordered_map> getParameterMap() { return expressionBinder.parameterMap; } @@ -187,11 +187,13 @@ class Binder { catalog::RelTableCatalogEntry* relTableEntry); std::unique_ptr bindCopyNodeFromNoSchema( const parser::Statement& statement, - const common::case_insensitive_map_t& boundCopyOptions, + const common::case_insensitive_map_t& + boundCopyOptions, bool temporary = false); std::unique_ptr bindCopyRelFromNoSchema( const parser::Statement& statement, - const common::case_insensitive_map_t& boundCopyOptions, + const common::case_insensitive_map_t& + boundCopyOptions, bool temporary = false); std::unique_ptr bindCopyToClause( @@ -230,7 +232,7 @@ class Binder { const std::vector& columnNames, const std::vector& columnTypes); - common::case_insensitive_map_t bindParsingOptions( + common::case_insensitive_map_t bindParsingOptions( const parser::options_t& parsingOptions); common::FileTypeInfo bindFileTypeInfo( const std::vector& filePaths) const; diff --git a/include/neug/compiler/binder/bound_attach_info.h b/include/neug/compiler/binder/bound_attach_info.h index 58f60e793..22296f5e7 100644 --- a/include/neug/compiler/binder/bound_attach_info.h +++ b/include/neug/compiler/binder/bound_attach_info.h @@ -29,7 +29,7 @@ namespace neug { namespace binder { struct NEUG_API AttachOption { - common::case_insensitive_map_t options; + common::case_insensitive_map_t options; }; struct NEUG_API AttachInfo { diff --git a/include/neug/compiler/binder/copy/bound_query_scan_info.h b/include/neug/compiler/binder/copy/bound_query_scan_info.h index 61f0ddf11..4df28fbd7 100644 --- a/include/neug/compiler/binder/copy/bound_query_scan_info.h +++ b/include/neug/compiler/binder/copy/bound_query_scan_info.h @@ -28,10 +28,10 @@ namespace neug { namespace binder { struct BoundQueryScanSourceInfo { - common::case_insensitive_map_t options; + common::case_insensitive_map_t options; explicit BoundQueryScanSourceInfo( - common::case_insensitive_map_t options) + common::case_insensitive_map_t options) : options{std::move(options)} {} }; diff --git a/include/neug/compiler/binder/ddl/bound_create_table_info.h b/include/neug/compiler/binder/ddl/bound_create_table_info.h index db7fb8010..74d144a64 100644 --- a/include/neug/compiler/binder/ddl/bound_create_table_info.h +++ b/include/neug/compiler/binder/ddl/bound_create_table_info.h @@ -132,7 +132,7 @@ struct BoundExtraCreateRelTableInfo final : BoundExtraCreateTableInfo { common::table_id_t dstTableID; std::string srcLabelName; std::string dstTableName; - common::case_insensitive_map_t options; + common::case_insensitive_map_t options; BoundExtraCreateRelTableInfo(common::table_id_t srcTableID, common::table_id_t dstTableID, diff --git a/include/neug/compiler/binder/expression/expression_util.h b/include/neug/compiler/binder/expression/expression_util.h index 9b13f801b..18272ebbf 100644 --- a/include/neug/compiler/binder/expression/expression_util.h +++ b/include/neug/compiler/binder/expression/expression_util.h @@ -95,7 +95,7 @@ struct NEUG_API ExpressionUtil { static bool canEvaluateAsLiteral(const Expression& expr); - static common::Value evaluateAsLiteralValue(const Expression& expr); + static compiler_impl::Value evaluateAsLiteralValue(const Expression& expr); template using validate_param_func = void(T); diff --git a/include/neug/compiler/binder/expression/literal_expression.h b/include/neug/compiler/binder/expression/literal_expression.h index aef41f0eb..d8a896945 100644 --- a/include/neug/compiler/binder/expression/literal_expression.h +++ b/include/neug/compiler/binder/expression/literal_expression.h @@ -30,7 +30,7 @@ namespace binder { class NEUG_API LiteralExpression final : public Expression { public: - LiteralExpression(common::Value value, const std::string& uniqueName) + LiteralExpression(compiler_impl::Value value, const std::string& uniqueName) : Expression{common::ExpressionType::LITERAL, value.getDataType().copy(), uniqueName}, value{std::move(value)} {} @@ -39,7 +39,7 @@ class NEUG_API LiteralExpression final : public Expression { void cast(const common::DataType& type) override; - common::Value getValue() const { return value; } + compiler_impl::Value getValue() const { return value; } std::string toStringInternal() const override { return value.toString(); } @@ -48,7 +48,7 @@ class NEUG_API LiteralExpression final : public Expression { } public: - common::Value value; + compiler_impl::Value value; }; } // namespace binder diff --git a/include/neug/compiler/binder/expression/parameter_expression.h b/include/neug/compiler/binder/expression/parameter_expression.h index c4416cace..ef69ed869 100644 --- a/include/neug/compiler/binder/expression/parameter_expression.h +++ b/include/neug/compiler/binder/expression/parameter_expression.h @@ -34,7 +34,7 @@ class NEUG_API ParameterExpression final : public Expression { public: explicit ParameterExpression(const std::string& parameterName, - common::Value value) + compiler_impl::Value value) : Expression{expressionType, value.getDataType().copy(), createUniqueName(parameterName)}, parameterName(parameterName), @@ -42,7 +42,7 @@ class NEUG_API ParameterExpression final : public Expression { void cast(const common::DataType& type) override; - common::Value getValue() const { return value; } + compiler_impl::Value getValue() const { return value; } std::string getName() const { return parameterName; } @@ -54,7 +54,7 @@ class NEUG_API ParameterExpression final : public Expression { private: std::string parameterName; - common::Value value; + compiler_impl::Value value; }; } // namespace binder diff --git a/include/neug/compiler/binder/expression_binder.h b/include/neug/compiler/binder/expression_binder.h index 8b500ad4f..a731590ea 100644 --- a/include/neug/compiler/binder/expression_binder.h +++ b/include/neug/compiler/binder/expression_binder.h @@ -133,12 +133,12 @@ class ExpressionBinder { std::shared_ptr bindLiteralExpression( const parser::ParsedExpression& parsedExpression) const; std::shared_ptr createLiteralExpression( - const common::Value& value) const; + const compiler_impl::Value& value) const; std::shared_ptr createLiteralExpression( const std::string& strVal) const; std::shared_ptr createNullLiteralExpression() const; std::shared_ptr createNullLiteralExpression( - const common::Value& value) const; + const compiler_impl::Value& value) const; // Variable expressions. std::shared_ptr bindVariableExpression( const parser::ParsedExpression& parsedExpression) const; @@ -176,7 +176,8 @@ class ExpressionBinder { private: Binder* binder; main::ClientContext* context; - std::unordered_map> parameterMap; + std::unordered_map> + parameterMap; ExpressionBinderConfig config; }; diff --git a/include/neug/compiler/binder/expression_evaluator_utils.h b/include/neug/compiler/binder/expression_evaluator_utils.h index d92e9b5b6..fedc09754 100644 --- a/include/neug/compiler/binder/expression_evaluator_utils.h +++ b/include/neug/compiler/binder/expression_evaluator_utils.h @@ -30,7 +30,7 @@ namespace neug { namespace evaluator { struct ExpressionEvaluatorUtils { - static NEUG_API common::Value evaluateConstantExpression( + static NEUG_API compiler_impl::Value evaluateConstantExpression( std::shared_ptr expression, main::ClientContext* clientContext); }; diff --git a/include/neug/compiler/binder/literal_evaluator.h b/include/neug/compiler/binder/literal_evaluator.h index 8881a7683..ac8f5e9a6 100644 --- a/include/neug/compiler/binder/literal_evaluator.h +++ b/include/neug/compiler/binder/literal_evaluator.h @@ -33,7 +33,7 @@ class LiteralExpressionEvaluator : public ExpressionEvaluator { public: LiteralExpressionEvaluator(std::shared_ptr expression, - common::Value value) + compiler_impl::Value value) : ExpressionEvaluator{type_, std::move(expression), true /* isResultFlat */}, value{std::move(value)} {} @@ -53,7 +53,7 @@ class LiteralExpressionEvaluator : public ExpressionEvaluator { storage::MemoryManager* memoryManager) override; private: - common::Value value; + compiler_impl::Value value; std::shared_ptr flatState; std::shared_ptr unFlatState; }; diff --git a/include/neug/compiler/catalog/catalog_entry/sequence_catalog_entry.h b/include/neug/compiler/catalog/catalog_entry/sequence_catalog_entry.h index 79e9e81db..afd3b40b1 100644 --- a/include/neug/compiler/catalog/catalog_entry/sequence_catalog_entry.h +++ b/include/neug/compiler/catalog/catalog_entry/sequence_catalog_entry.h @@ -29,9 +29,6 @@ #include "neug/compiler/common/vector/value_vector.h" namespace neug { -namespace common { -class ValueVector; -} namespace binder { struct BoundExtraCreateCatalogEntryInfo; diff --git a/include/neug/compiler/common/copier_config/csv_reader_config.h b/include/neug/compiler/common/copier_config/csv_reader_config.h index 359807dc3..f79eaab33 100644 --- a/include/neug/compiler/common/copier_config/csv_reader_config.h +++ b/include/neug/compiler/common/copier_config/csv_reader_config.h @@ -130,7 +130,7 @@ struct CSVReaderConfig { EXPLICIT_COPY_DEFAULT_MOVE(CSVReaderConfig); static CSVReaderConfig construct( - const case_insensitive_map_t& options); + const case_insensitive_map_t& options); private: CSVReaderConfig(const CSVReaderConfig& other) diff --git a/include/neug/compiler/common/copier_config/file_scan_info.h b/include/neug/compiler/common/copier_config/file_scan_info.h index 036532352..c1f94af74 100644 --- a/include/neug/compiler/common/copier_config/file_scan_info.h +++ b/include/neug/compiler/common/copier_config/file_scan_info.h @@ -55,7 +55,7 @@ struct FileScanInfo { FileTypeInfo fileTypeInfo; std::vector filePaths; - case_insensitive_map_t options; + case_insensitive_map_t options; FileScanInfo() : fileTypeInfo{FileType::UNKNOWN, ""} {} FileScanInfo(FileTypeInfo fileTypeInfo, std::vector filePaths) diff --git a/include/neug/compiler/common/type_utils.h b/include/neug/compiler/common/type_utils.h index 0a5099f8d..e46cf51da 100644 --- a/include/neug/compiler/common/type_utils.h +++ b/include/neug/compiler/common/type_utils.h @@ -124,7 +124,7 @@ class TypeUtils { return common::PhysicalTypeID::DOUBLE; } else if constexpr (std::is_same_v) { return common::PhysicalTypeID::INT128; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { return common::PhysicalTypeID::INTERVAL; } else if constexpr (std::same_as || std::same_as || @@ -202,15 +202,15 @@ class TypeUtils { case DataTypeId::kFloat: return func(float()); case DataTypeId::kInterval: - return func(interval_t()); + return func(compiler_impl::interval_t()); case DataTypeId::kInternalId: return func(internalID_t()); case DataTypeId::kVarchar: return func(neug_string_t()); case DataTypeId::kDate: - return func(date_t()); + return func(compiler_impl::date_t()); case DataTypeId::kTimestampMs: - return func(timestamp_ms_t()); + return func(compiler_impl::timestamp_ms_t()); case DataTypeId::kArray: case DataTypeId::kList: return func(list_entry_t()); @@ -260,7 +260,7 @@ class TypeUtils { case PhysicalTypeID::FLOAT: return func(float()); case PhysicalTypeID::INTERVAL: - return func(interval_t()); + return func(compiler_impl::interval_t()); case PhysicalTypeID::INTERNAL_ID: return func(internalID_t()); case PhysicalTypeID::STRING: @@ -294,13 +294,17 @@ std::string TypeUtils::toString(const bool& val, void* valueVector); template <> std::string TypeUtils::toString(const internalID_t& val, void* valueVector); template <> -std::string TypeUtils::toString(const date_t& val, void* valueVector); +std::string TypeUtils::toString(const compiler_impl::date_t& val, + void* valueVector); template <> -std::string TypeUtils::toString(const timestamp_ms_t& val, void* valueVector); +std::string TypeUtils::toString(const compiler_impl::timestamp_ms_t& val, + void* valueVector); template <> -std::string TypeUtils::toString(const timestamp_t& val, void* valueVector); +std::string TypeUtils::toString(const compiler_impl::timestamp_t& val, + void* valueVector); template <> -std::string TypeUtils::toString(const interval_t& val, void* valueVector); +std::string TypeUtils::toString(const compiler_impl::interval_t& val, + void* valueVector); template <> std::string TypeUtils::toString(const neug_string_t& val, void* valueVector); template <> diff --git a/include/neug/compiler/common/types/cast_helpers.h b/include/neug/compiler/common/types/cast_helpers.h index b03b8830c..38cdc14cc 100644 --- a/include/neug/compiler/common/types/cast_helpers.h +++ b/include/neug/compiler/common/types/cast_helpers.h @@ -109,7 +109,7 @@ struct DateToStringCast { addBC = false; if (date[0] <= 0) { // add (BC) suffix - length += strlen(Date::BC_SUFFIX); + length += strlen(compiler_impl::Date::BC_SUFFIX); date[0] = -date[0] + 1; addBC = true; } @@ -148,9 +148,10 @@ struct DateToStringCast { // optionally add BC to the end of the date if (addBC) { memcpy(ptr, - Date::BC_SUFFIX, // NOLINT(bugprone-not-null-terminated-result): - // no need to put null terminator - strlen(Date::BC_SUFFIX)); + compiler_impl::Date:: + BC_SUFFIX, // NOLINT(bugprone-not-null-terminated-result): + // no need to put null terminator + strlen(compiler_impl::Date::BC_SUFFIX)); } } }; @@ -268,7 +269,7 @@ struct IntervalToStringCast { //! spaces between all characters (+3 characters) //! Total: 70 characters //! Returns the length of the interval - static uint64_t Format(interval_t interval, char buffer[]) { + static uint64_t Format(compiler_impl::interval_t interval, char buffer[]) { uint64_t length = 0; if (interval.months != 0) { int32_t years = interval.months / 12; @@ -292,12 +293,12 @@ struct IntervalToStringCast { buffer[length++] = '-'; micros = -micros; } - int64_t hour = micros / Interval::MICROS_PER_HOUR; - micros -= hour * Interval::MICROS_PER_HOUR; - int64_t min = micros / Interval::MICROS_PER_MINUTE; - micros -= min * Interval::MICROS_PER_MINUTE; - int64_t sec = micros / Interval::MICROS_PER_SEC; - micros -= sec * Interval::MICROS_PER_SEC; + int64_t hour = micros / compiler_impl::Interval::MICROS_PER_HOUR; + micros -= hour * compiler_impl::Interval::MICROS_PER_HOUR; + int64_t min = micros / compiler_impl::Interval::MICROS_PER_MINUTE; + micros -= min * compiler_impl::Interval::MICROS_PER_MINUTE; + int64_t sec = micros / compiler_impl::Interval::MICROS_PER_SEC; + micros -= sec * compiler_impl::Interval::MICROS_PER_SEC; if (hour < 10) { buffer[length++] = '0'; diff --git a/include/neug/compiler/common/types/date_t.h b/include/neug/compiler/common/types/date_t.h index f9b950c05..e1b19aa45 100644 --- a/include/neug/compiler/common/types/date_t.h +++ b/include/neug/compiler/common/types/date_t.h @@ -30,7 +30,7 @@ namespace regex { class RE2; } -namespace common { +namespace compiler_impl { struct timestamp_t; @@ -143,5 +143,6 @@ class Date { int32_t& year_offset); }; -} // namespace common +} // namespace compiler_impl + } // namespace neug diff --git a/include/neug/compiler/common/types/interval_t.h b/include/neug/compiler/common/types/interval_t.h index 33abe917c..336a11cc3 100644 --- a/include/neug/compiler/common/types/interval_t.h +++ b/include/neug/compiler/common/types/interval_t.h @@ -33,7 +33,7 @@ namespace regex { class RE2; } -namespace common { +namespace compiler_impl { struct timestamp_t; struct date_t; @@ -152,5 +152,6 @@ class Interval { NEUG_API static const regex::RE2& regexPattern2(); }; -} // namespace common +} // namespace compiler_impl + } // namespace neug diff --git a/include/neug/compiler/common/types/timestamp_t.h b/include/neug/compiler/common/types/timestamp_t.h index 4a5f41a83..d60fb7c0d 100644 --- a/include/neug/compiler/common/types/timestamp_t.h +++ b/include/neug/compiler/common/types/timestamp_t.h @@ -26,7 +26,7 @@ #include "dtime_t.h" namespace neug { -namespace common { +namespace compiler_impl { // Type used to represent timestamps (value is in microseconds since 1970-01-01) struct NEUG_API timestamp_t { @@ -97,17 +97,17 @@ class Timestamp { NEUG_API static date_t getDate(timestamp_t timestamp); - NEUG_API static dtime_t getTime(timestamp_t timestamp); + NEUG_API static common::dtime_t getTime(timestamp_t timestamp); // Create a Timestamp object from a specified (date, time) combination. - NEUG_API static timestamp_t fromDateTime(date_t date, dtime_t time); + NEUG_API static timestamp_t fromDateTime(date_t date, common::dtime_t time); NEUG_API static bool tryConvertTimestamp(const char* str, uint64_t len, timestamp_t& result); // Extract the date and time from a given timestamp object. NEUG_API static void convert(timestamp_t timestamp, date_t& out_date, - dtime_t& out_time); + common::dtime_t& out_time); // Create a Timestamp object from the specified epochMs. NEUG_API static timestamp_t fromEpochMicroSeconds(int64_t epochMs); @@ -147,5 +147,6 @@ class Timestamp { NEUG_API static timestamp_t getCurrentTimestamp(); }; -} // namespace common +} // namespace compiler_impl + } // namespace neug diff --git a/include/neug/compiler/common/types/types.h b/include/neug/compiler/common/types/types.h index dfef96691..ff5e4828b 100644 --- a/include/neug/compiler/common/types/types.h +++ b/include/neug/compiler/common/types/types.h @@ -168,7 +168,7 @@ concept NumericTypes = IntegerTypes || std::floating_point; template concept ComparableTypes = NumericTypes || std::is_same_v || - std::is_same_v || std::is_same_v; + std::is_same_v || std::is_same_v; template concept HashablePrimitive = ((std::integral && !std::is_same_v) || @@ -181,11 +181,11 @@ concept IndexHashable = std::is_same_v || std::same_as); template -concept HashableNonNestedTypes = (std::integral || std::floating_point || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v); +concept HashableNonNestedTypes = + (std::integral || std::floating_point || + std::is_same_v || std::is_same_v || + std::is_same_v || + std::is_same_v); template concept HashableNestedTypes = (std::is_same_v || diff --git a/include/neug/compiler/common/types/value/nested.h b/include/neug/compiler/common/types/value/nested.h index 36944671b..da805b11e 100644 --- a/include/neug/compiler/common/types/value/nested.h +++ b/include/neug/compiler/common/types/value/nested.h @@ -28,15 +28,18 @@ #include "neug/utils/api.h" namespace neug { -namespace common { - +namespace compiler_impl { class Value; +} // namespace compiler_impl + +namespace common { class NestedVal { public: - NEUG_API static uint32_t getChildrenSize(const Value* val); + NEUG_API static uint32_t getChildrenSize(const compiler_impl::Value* val); - NEUG_API static Value* getChildVal(const Value* val, uint32_t idx); + NEUG_API static compiler_impl::Value* getChildVal( + const compiler_impl::Value* val, uint32_t idx); }; } // namespace common diff --git a/include/neug/compiler/common/types/value/node.h b/include/neug/compiler/common/types/value/node.h index 2de3c9603..fa7be71e2 100644 --- a/include/neug/compiler/common/types/value/node.h +++ b/include/neug/compiler/common/types/value/node.h @@ -31,9 +31,11 @@ #include "neug/utils/api.h" namespace neug { -namespace common { - +namespace compiler_impl { class Value; +} // namespace compiler_impl + +namespace common { /** * @brief NodeVal represents a node in the graph and stores the nodeID, label @@ -46,37 +48,42 @@ class NodeVal { * @note this function copies all the properties into a vector, which is not * efficient. use `getPropertyName` and `getPropertyVal` instead if possible. */ - NEUG_API static std::vector>> - getProperties(const Value* val); + NEUG_API static std::vector< + std::pair>> + getProperties(const compiler_impl::Value* val); /** * @return number of properties of the RelVal. */ - NEUG_API static uint64_t getNumProperties(const Value* val); + NEUG_API static uint64_t getNumProperties(const compiler_impl::Value* val); /** * @return the name of the property at the given index. */ - NEUG_API static std::string getPropertyName(const Value* val, uint64_t index); + NEUG_API static std::string getPropertyName(const compiler_impl::Value* val, + uint64_t index); /** * @return the value of the property at the given index. */ - NEUG_API static Value* getPropertyVal(const Value* val, uint64_t index); + NEUG_API static compiler_impl::Value* getPropertyVal( + const compiler_impl::Value* val, uint64_t index); /** * @return the nodeID as a Value. */ - NEUG_API static Value* getNodeIDVal(const Value* val); + NEUG_API static compiler_impl::Value* getNodeIDVal( + const compiler_impl::Value* val); /** * @return the name of the node as a Value. */ - NEUG_API static Value* getLabelVal(const Value* val); + NEUG_API static compiler_impl::Value* getLabelVal( + const compiler_impl::Value* val); /** * @return the current node values in string format. */ - NEUG_API static std::string toString(const Value* val); + NEUG_API static std::string toString(const compiler_impl::Value* val); private: - static void throwIfNotNode(const Value* val); + static void throwIfNotNode(const compiler_impl::Value* val); // 2 offsets for id and label. static constexpr uint64_t OFFSET = 2; }; diff --git a/include/neug/compiler/common/types/value/recursive_rel.h b/include/neug/compiler/common/types/value/recursive_rel.h index 0b1f2d729..4c120fa56 100644 --- a/include/neug/compiler/common/types/value/recursive_rel.h +++ b/include/neug/compiler/common/types/value/recursive_rel.h @@ -25,9 +25,11 @@ #include "neug/utils/api.h" namespace neug { -namespace common { - +namespace compiler_impl { class Value; +} // namespace compiler_impl + +namespace common { /** * @brief RecursiveRelVal represents a path in the graph and stores the @@ -38,15 +40,17 @@ class RecursiveRelVal { /** * @return the list of nodes in the recursive rel as a Value. */ - NEUG_API static Value* getNodes(const Value* val); + NEUG_API static compiler_impl::Value* getNodes( + const compiler_impl::Value* val); /** * @return the list of rels in the recursive rel as a Value. */ - NEUG_API static Value* getRels(const Value* val); + NEUG_API static compiler_impl::Value* getRels( + const compiler_impl::Value* val); private: - static void throwIfNotRecursiveRel(const Value* val); + static void throwIfNotRecursiveRel(const compiler_impl::Value* val); }; } // namespace common diff --git a/include/neug/compiler/common/types/value/rel.h b/include/neug/compiler/common/types/value/rel.h index c502caade..19e7e0010 100644 --- a/include/neug/compiler/common/types/value/rel.h +++ b/include/neug/compiler/common/types/value/rel.h @@ -31,9 +31,11 @@ #include "neug/utils/api.h" namespace neug { -namespace common { - +namespace compiler_impl { class Value; +} // namespace compiler_impl + +namespace common { /** * @brief RelVal represents a rel in the graph and stores the relID, src/dst @@ -46,43 +48,50 @@ class RelVal { * @note this function copies all the properties into a vector, which is not * efficient. use `getPropertyName` and `getPropertyVal` instead if possible. */ - NEUG_API static std::vector>> - getProperties(const Value* val); + NEUG_API static std::vector< + std::pair>> + getProperties(const compiler_impl::Value* val); /** * @return number of properties of the RelVal. */ - NEUG_API static uint64_t getNumProperties(const Value* val); + NEUG_API static uint64_t getNumProperties(const compiler_impl::Value* val); /** * @return the name of the property at the given index. */ - NEUG_API static std::string getPropertyName(const Value* val, uint64_t index); + NEUG_API static std::string getPropertyName(const compiler_impl::Value* val, + uint64_t index); /** * @return the value of the property at the given index. */ - NEUG_API static Value* getPropertyVal(const Value* val, uint64_t index); + NEUG_API static compiler_impl::Value* getPropertyVal( + const compiler_impl::Value* val, uint64_t index); /** * @return the src nodeID value of the RelVal in Value. */ - NEUG_API static Value* getSrcNodeIDVal(const Value* val); + NEUG_API static compiler_impl::Value* getSrcNodeIDVal( + const compiler_impl::Value* val); /** * @return the dst nodeID value of the RelVal in Value. */ - NEUG_API static Value* getDstNodeIDVal(const Value* val); + NEUG_API static compiler_impl::Value* getDstNodeIDVal( + const compiler_impl::Value* val); /** * @return the internal ID value of the RelVal in Value. */ - NEUG_API static Value* getIDVal(const Value* val); + NEUG_API static compiler_impl::Value* getIDVal( + const compiler_impl::Value* val); /** * @return the label value of the RelVal. */ - NEUG_API static Value* getLabelVal(const Value* val); + NEUG_API static compiler_impl::Value* getLabelVal( + const compiler_impl::Value* val); /** * @return the value of the RelVal in string format. */ - NEUG_API static std::string toString(const Value* val); + NEUG_API static std::string toString(const compiler_impl::Value* val); private: - static void throwIfNotRel(const Value* val); + static void throwIfNotRel(const compiler_impl::Value* val); // 4 offset for id, label, src, dst. static constexpr uint64_t OFFSET = 4; }; diff --git a/include/neug/compiler/common/types/value/value.h b/include/neug/compiler/common/types/value/value.h index 691b9a484..42917cd53 100644 --- a/include/neug/compiler/common/types/value/value.h +++ b/include/neug/compiler/common/types/value/value.h @@ -34,24 +34,34 @@ namespace neug { namespace common { - +class Deserializer; +class Serializer; +class NestedVal; class NodeVal; +class RecursiveRelVal; class RelVal; +class ValueVector; +} // namespace common + +namespace compiler_impl { + +using common::int128_t; +using common::internalID_t; +using common::list_entry_t; +using common::neug_list_t; +using common::nodeID_t; +using common::struct_entry_t; + struct FileInfo; -class NestedVal; -class RecursiveRelVal; class ArrowRowBatch; -class ValueVector; -class Serializer; -class Deserializer; class Value { - friend class NodeVal; - friend class RelVal; - friend class NestedVal; - friend class RecursiveRelVal; + friend class common::NodeVal; + friend class common::RelVal; + friend class common::NestedVal; + friend class common::RecursiveRelVal; friend class ArrowRowBatch; - friend class ValueVector; + friend class common::ValueVector; public: /** @@ -199,7 +209,7 @@ class Value { * @param value value to copy from. */ NEUG_API void copyFromColLayout(const uint8_t* value, - ValueVector* vec = nullptr); + common::ValueVector* vec = nullptr); /** * @brief Copies from the other. * @param other value to copy from. @@ -237,10 +247,10 @@ class Value { */ NEUG_API std::string toString() const; - NEUG_API void serialize(Serializer& serializer) const; + NEUG_API void serialize(common::Serializer& serializer) const; NEUG_API static std::unique_ptr deserialize( - Deserializer& deserializer); + common::Deserializer& deserializer); NEUG_API void validateType(common::DataTypeId targetTypeID) const; @@ -258,10 +268,11 @@ class Value { void resizeChildrenVector(uint64_t size, const DataType& childType); void copyFromRowLayoutList(const neug_list_t& list, const DataType& childType); - void copyFromColLayoutList(const list_entry_t& list, ValueVector* vec); + void copyFromColLayoutList(const list_entry_t& list, + common::ValueVector* vec); void copyFromRowLayoutStruct(const uint8_t* kuStruct); void copyFromColLayoutStruct(const struct_entry_t& structEntry, - ValueVector* vec); + common::ValueVector* vec); std::string mapToString() const; std::string listToString() const; std::string structToString() const; @@ -773,5 +784,6 @@ NEUG_API inline Value Value::createValue(const char* value) { return Value(DataType::Varchar(), std::string(value)); } -} // namespace common +} // namespace compiler_impl + } // namespace neug diff --git a/include/neug/compiler/common/vector/value_vector.h b/include/neug/compiler/common/vector/value_vector.h index ef28c6494..5c19082b6 100644 --- a/include/neug/compiler/common/vector/value_vector.h +++ b/include/neug/compiler/common/vector/value_vector.h @@ -34,9 +34,13 @@ #include "neug/compiler/common/vector/auxiliary_buffer.h" namespace neug { +namespace compiler_impl { +class Value; +} // namespace compiler_impl + namespace common { -class Value; +class ValueVector; //! A Vector represents values of the same data type. //! The capacity of a ValueVector is either 1 (sequence) or @@ -140,9 +144,9 @@ class NEUG_API ValueVector { const uint8_t* srcVectorData); void copyFromVectorData(uint64_t dstPos, const ValueVector* srcVector, uint64_t srcPos); - void copyFromValue(uint64_t pos, const Value& value); + void copyFromValue(uint64_t pos, const compiler_impl::Value& value); - std::unique_ptr getAsValue(uint64_t pos) const; + std::unique_ptr getAsValue(uint64_t pos) const; uint8_t* getData() const { return valueBuffer.get(); } @@ -220,13 +224,13 @@ struct NEUG_API BlobVector { static void addBlob(ValueVector* vector, uint32_t pos, const char* data, uint32_t length) { StringVector::addString(vector, pos, data, length); - } // namespace common + } static void addBlob(ValueVector* vector, uint32_t pos, const uint8_t* data, uint64_t length) { StringVector::addString(vector, pos, reinterpret_cast(data), length); } -}; // namespace neug +}; // ListVector is used for both LIST and ARRAY physical type class NEUG_API ListVector { diff --git a/include/neug/compiler/function/cast/functions/cast_from_string_functions.h b/include/neug/compiler/function/cast/functions/cast_from_string_functions.h index 91fd0c350..22488491b 100644 --- a/include/neug/compiler/function/cast/functions/cast_from_string_functions.h +++ b/include/neug/compiler/function/cast/functions/cast_from_string_functions.h @@ -150,42 +150,44 @@ inline void CastString::operation(const neug_string_t& input, double& result, } template <> -inline void CastString::operation(const neug_string_t& input, date_t& result, +inline void CastString::operation(const neug_string_t& input, + compiler_impl::date_t& result, ValueVector* /*resultVector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = - neug::common::Date::fromCString((const char*) input.getData(), input.len); + result = compiler_impl::Date::fromCString((const char*) input.getData(), + input.len); } template <> inline void CastString::operation(const neug_string_t& input, - neug::common::timestamp_t& result, + compiler_impl::timestamp_t& result, ValueVector* /*resultVector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = Timestamp::fromCString((const char*) input.getData(), input.len); + result = compiler_impl::Timestamp::fromCString((const char*) input.getData(), + input.len); } template <> inline void CastString::operation(const neug_string_t& input, - timestamp_ms_t& result, + compiler_impl::timestamp_ms_t& result, ValueVector* /*resultVector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - TryCastStringToTimestamp::cast((const char*) input.getData(), - input.len, result, - DataTypeId::kTimestampMs); + TryCastStringToTimestamp::cast( + (const char*) input.getData(), input.len, result, + DataTypeId::kTimestampMs); } template <> inline void CastString::operation(const neug_string_t& input, - interval_t& result, + compiler_impl::interval_t& result, ValueVector* /*resultVector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = neug::common::Interval::fromCString((const char*) input.getData(), - input.len); + result = compiler_impl::Interval::fromCString((const char*) input.getData(), + input.len); } template <> diff --git a/include/neug/compiler/function/cast/functions/cast_functions.h b/include/neug/compiler/function/cast/functions/cast_functions.h index 94bfdd81e..eb5846a75 100644 --- a/include/neug/compiler/function/cast/functions/cast_functions.h +++ b/include/neug/compiler/function/cast/functions/cast_functions.h @@ -63,64 +63,64 @@ struct CastRelToString { struct CastDateToTimestamp { template - static inline void operation(common::date_t& input, T& result) { + static inline void operation(compiler_impl::date_t& input, T& result) { // base case: timestamp - result = common::Timestamp::fromDateTime(input, common::dtime_t{}); + result = compiler_impl::Timestamp::fromDateTime(input, common::dtime_t{}); } }; template <> -inline void CastDateToTimestamp::operation(common::date_t& input, - common::timestamp_ns_t& result) { - operation(input, result); - result = - common::timestamp_ns_t{common::Timestamp::getEpochNanoSeconds(result)}; +inline void CastDateToTimestamp::operation( + compiler_impl::date_t& input, compiler_impl::timestamp_ns_t& result) { + operation(input, result); + result = compiler_impl::timestamp_ns_t{ + compiler_impl::Timestamp::getEpochNanoSeconds(result)}; } template <> -inline void CastDateToTimestamp::operation(common::date_t& input, - common::timestamp_ms_t& result) { - operation(input, result); - result.value /= common::Interval::MICROS_PER_MSEC; +inline void CastDateToTimestamp::operation( + compiler_impl::date_t& input, compiler_impl::timestamp_ms_t& result) { + operation(input, result); + result.value /= compiler_impl::Interval::MICROS_PER_MSEC; } template <> -inline void CastDateToTimestamp::operation(common::date_t& input, - common::timestamp_sec_t& result) { - operation(input, result); - result.value /= common::Interval::MICROS_PER_SEC; +inline void CastDateToTimestamp::operation( + compiler_impl::date_t& input, compiler_impl::timestamp_sec_t& result) { + operation(input, result); + result.value /= compiler_impl::Interval::MICROS_PER_SEC; } struct CastToDate { template - static inline void operation(T& input, common::date_t& result); + static inline void operation(T& input, compiler_impl::date_t& result); }; template <> -inline void CastToDate::operation(common::timestamp_t& input, - common::date_t& result) { - result = common::Timestamp::getDate(input); +inline void CastToDate::operation(compiler_impl::timestamp_t& input, + compiler_impl::date_t& result) { + result = compiler_impl::Timestamp::getDate(input); } template <> -inline void CastToDate::operation(common::timestamp_ns_t& input, - common::date_t& result) { - auto tmp = common::Timestamp::fromEpochNanoSeconds(input.value); - operation(tmp, result); +inline void CastToDate::operation(compiler_impl::timestamp_ns_t& input, + compiler_impl::date_t& result) { + auto tmp = compiler_impl::Timestamp::fromEpochNanoSeconds(input.value); + operation(tmp, result); } template <> -inline void CastToDate::operation(common::timestamp_ms_t& input, - common::date_t& result) { - auto tmp = common::Timestamp::fromEpochMilliSeconds(input.value); - operation(tmp, result); +inline void CastToDate::operation(compiler_impl::timestamp_ms_t& input, + compiler_impl::date_t& result) { + auto tmp = compiler_impl::Timestamp::fromEpochMilliSeconds(input.value); + operation(tmp, result); } template <> -inline void CastToDate::operation(common::timestamp_sec_t& input, - common::date_t& result) { - auto tmp = common::Timestamp::fromEpochSeconds(input.value); - operation(tmp, result); +inline void CastToDate::operation(compiler_impl::timestamp_sec_t& input, + compiler_impl::date_t& result) { + auto tmp = compiler_impl::Timestamp::fromEpochSeconds(input.value); + operation(tmp, result); } struct CastToDouble { @@ -339,81 +339,105 @@ struct CastBetweenTimestamp { }; template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_t& input, - common::timestamp_ns_t& output) { - output.value = common::Timestamp::getEpochNanoSeconds(input); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_t& input, + compiler_impl::timestamp_ns_t& output) { + output.value = compiler_impl::Timestamp::getEpochNanoSeconds(input); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_t& input, - common::timestamp_ms_t& output) { - output.value = common::Timestamp::getEpochMilliSeconds(input); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_t& input, + compiler_impl::timestamp_ms_t& output) { + output.value = compiler_impl::Timestamp::getEpochMilliSeconds(input); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_t& input, - common::timestamp_sec_t& output) { - output.value = common::Timestamp::getEpochSeconds(input); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_t& input, + compiler_impl::timestamp_sec_t& output) { + output.value = compiler_impl::Timestamp::getEpochSeconds(input); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ms_t& input, - common::timestamp_t& output) { - output = common::Timestamp::fromEpochMilliSeconds(input.value); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ms_t& input, + compiler_impl::timestamp_t& output) { + output = compiler_impl::Timestamp::fromEpochMilliSeconds(input.value); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ms_t& input, - common::timestamp_ns_t& output) { - operation(input, output); - operation(output, output); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ms_t& input, + compiler_impl::timestamp_ns_t& output) { + operation(input, + output); + operation(output, + output); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ms_t& input, - common::timestamp_sec_t& output) { - operation(input, output); - operation(output, output); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ms_t& input, + compiler_impl::timestamp_sec_t& output) { + operation(input, + output); + operation(output, + output); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ns_t& input, - common::timestamp_t& output) { - output = common::Timestamp::fromEpochNanoSeconds(input.value); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ns_t& input, + compiler_impl::timestamp_t& output) { + output = compiler_impl::Timestamp::fromEpochNanoSeconds(input.value); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ns_t& input, - common::timestamp_ms_t& output) { - operation(input, output); - operation(output, output); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ns_t& input, + compiler_impl::timestamp_ms_t& output) { + operation(input, + output); + operation(output, + output); } template <> -inline void CastBetweenTimestamp::operation(const common::timestamp_ns_t& input, - common::timestamp_sec_t& output) { - operation(input, output); - operation(output, output); +inline void CastBetweenTimestamp::operation( + const compiler_impl::timestamp_ns_t& input, + compiler_impl::timestamp_sec_t& output) { + operation(input, + output); + operation(output, + output); } template <> inline void CastBetweenTimestamp::operation( - const common::timestamp_sec_t& input, common::timestamp_t& output) { - output = common::Timestamp::fromEpochSeconds(input.value); + const compiler_impl::timestamp_sec_t& input, + compiler_impl::timestamp_t& output) { + output = compiler_impl::Timestamp::fromEpochSeconds(input.value); } template <> inline void CastBetweenTimestamp::operation( - const common::timestamp_sec_t& input, common::timestamp_ns_t& output) { - operation(input, output); - operation(output, output); + const compiler_impl::timestamp_sec_t& input, + compiler_impl::timestamp_ns_t& output) { + operation(input, + output); + operation(output, + output); } template <> inline void CastBetweenTimestamp::operation( - const common::timestamp_sec_t& input, common::timestamp_ms_t& output) { - operation(input, output); - operation(output, output); + const compiler_impl::timestamp_sec_t& input, + compiler_impl::timestamp_ms_t& output) { + operation(input, + output); + operation(output, + output); } } // namespace function diff --git a/include/neug/compiler/function/cast/functions/cast_string_non_nested_functions.h b/include/neug/compiler/function/cast/functions/cast_string_non_nested_functions.h index 993d1561d..b15bee9e5 100644 --- a/include/neug/compiler/function/cast/functions/cast_string_non_nested_functions.h +++ b/include/neug/compiler/function/cast/functions/cast_string_non_nested_functions.h @@ -273,21 +273,22 @@ inline void doubleCast(const char* input, uint64_t len, T& result, struct TryCastStringToTimestamp { template static bool tryCast(const char* input, uint64_t len, - neug::common::timestamp_t& result); + compiler_impl::timestamp_t& result); template static void cast(const char* input, uint64_t len, - neug::common::timestamp_t& result, DataTypeId typeID) { + compiler_impl::timestamp_t& result, DataTypeId typeID) { if (!tryCast(input, len, result)) { - THROW_CONVERSION_EXCEPTION(Timestamp::getTimestampConversionExceptionMsg( - input, len, LogicalTypeUtils::toString(typeID))); + THROW_CONVERSION_EXCEPTION( + compiler_impl::Timestamp::getTimestampConversionExceptionMsg( + input, len, LogicalTypeUtils::toString(typeID))); } } }; template <> -bool TryCastStringToTimestamp::tryCast( - const char* input, uint64_t len, neug::common::timestamp_t& result); +bool TryCastStringToTimestamp::tryCast( + const char* input, uint64_t len, compiler_impl::timestamp_t& result); } // namespace function } // namespace neug diff --git a/include/neug/compiler/function/comparison/vector_comparison_functions.h b/include/neug/compiler/function/comparison/vector_comparison_functions.h index 2ee83293b..4fa48ad98 100644 --- a/include/neug/compiler/function/comparison/vector_comparison_functions.h +++ b/include/neug/compiler/function/comparison/vector_comparison_functions.h @@ -138,8 +138,8 @@ struct ComparisonFunction { uint8_t, FUNC>; } break; case common::PhysicalTypeID::INTERVAL: { - func = BinaryComparisonExecFunction; + func = BinaryComparisonExecFunction< + compiler_impl::interval_t, compiler_impl::interval_t, uint8_t, FUNC>; } break; case common::PhysicalTypeID::ARRAY: case common::PhysicalTypeID::LIST: { @@ -211,8 +211,8 @@ struct ComparisonFunction { FUNC>; } break; case common::PhysicalTypeID::INTERVAL: { - func = BinaryComparisonSelectFunction; + func = BinaryComparisonSelectFunction; } break; case common::PhysicalTypeID::ARRAY: case common::PhysicalTypeID::LIST: { diff --git a/include/neug/compiler/function/export/export_function.h b/include/neug/compiler/function/export/export_function.h index bc2b26373..aa74a7af3 100644 --- a/include/neug/compiler/function/export/export_function.h +++ b/include/neug/compiler/function/export/export_function.h @@ -35,11 +35,11 @@ struct ExportFuncBindData { std::vector columnNames; std::vector types; std::string fileName; - common::case_insensitive_map_t options; + common::case_insensitive_map_t options; ExportFuncBindData( std::vector columnNames, std::string fileName, - const common::case_insensitive_map_t& options) + const common::case_insensitive_map_t& options) : columnNames{std::move(columnNames)}, fileName{std::move(fileName)}, options{options} {} @@ -71,7 +71,7 @@ struct ExportFuncBindData { struct ExportFuncBindInput { std::vector columnNames; std::string filePath; - common::case_insensitive_map_t parsingOptions; + common::case_insensitive_map_t parsingOptions; }; using export_bind_t = std::function( function::ExportFuncBindInput& bindInput)>; diff --git a/include/neug/compiler/function/list/functions/list_unique_function.h b/include/neug/compiler/function/list/functions/list_unique_function.h index 5e115976a..334c8bd2c 100644 --- a/include/neug/compiler/function/list/functions/list_unique_function.h +++ b/include/neug/compiler/function/list/functions/list_unique_function.h @@ -30,19 +30,20 @@ namespace neug { namespace function { struct ValueHashFunction { - uint64_t operator()(const common::Value& value) const { + uint64_t operator()(const compiler_impl::Value& value) const { return (uint64_t) value.computeHash(); } }; struct ValueEquality { - bool operator()(const common::Value& a, const common::Value& b) const { + bool operator()(const compiler_impl::Value& a, + const compiler_impl::Value& b) const { return a == b; } }; using ValueSet = - std::unordered_set; + std::unordered_set; using duplicate_value_handler = std::function; using unique_value_handler = diff --git a/include/neug/compiler/function/string/vector_string_functions.h b/include/neug/compiler/function/string/vector_string_functions.h index b4d295308..bc178962e 100644 --- a/include/neug/compiler/function/string/vector_string_functions.h +++ b/include/neug/compiler/function/string/vector_string_functions.h @@ -23,7 +23,7 @@ #pragma once #include "neug/compiler/function/scalar_function.h" -#include "neug/execution/common/types/value.h" +#include "neug/utils/function_type.h" namespace neug { namespace function { @@ -64,7 +64,7 @@ struct LowerFunction : public VectorStringFunction { static function_set getFunctionSet(); - static execution::Value Exec(const std::vector& args); + static neug::Value Exec(const std::vector& args); }; struct ToLowerFunction : public VectorStringFunction { @@ -84,8 +84,7 @@ struct ReverseFunction : public VectorStringFunction { static function_set getFunctionSet(); - static neug::execution::Value Exec( - const std::vector& args); + static neug::Value Exec(const std::vector& args); }; struct StartsWithFunction : public VectorStringFunction { @@ -99,8 +98,7 @@ struct UpperFunction : public VectorStringFunction { static function_set getFunctionSet(); - static neug::execution::Value Exec( - const std::vector& args); + static neug::Value Exec(const std::vector& args); }; struct ToUpperFunction : public VectorStringFunction { diff --git a/include/neug/compiler/function/table/bind_input.h b/include/neug/compiler/function/table/bind_input.h index e782bfed1..6443392aa 100644 --- a/include/neug/compiler/function/table/bind_input.h +++ b/include/neug/compiler/function/table/bind_input.h @@ -45,7 +45,7 @@ class Value; namespace function { -using optional_params_t = common::case_insensitive_map_t; +using optional_params_t = common::case_insensitive_map_t; struct TableFunction; @@ -68,12 +68,12 @@ struct NEUG_API TableFuncBindInput { TableFuncBindInput() = default; - void addLiteralParam(common::Value value); + void addLiteralParam(compiler_impl::Value value); std::shared_ptr getParam(common::idx_t idx) const { return params[idx]; } - common::Value getValue(common::idx_t idx) const; + compiler_impl::Value getValue(common::idx_t idx) const; template T getLiteralVal(common::idx_t idx) const; }; diff --git a/include/neug/compiler/function/timestamp/timestamp_function.h b/include/neug/compiler/function/timestamp/timestamp_function.h index 01bb95799..4d2664fcd 100644 --- a/include/neug/compiler/function/timestamp/timestamp_function.h +++ b/include/neug/compiler/function/timestamp/timestamp_function.h @@ -31,27 +31,30 @@ namespace neug { namespace function { struct Century { - static inline void operation(common::timestamp_t& timestamp, + static inline void operation(compiler_impl::timestamp_t& timestamp, int64_t& result) { - result = common::Timestamp::getTimestampPart( - common::DatePartSpecifier::CENTURY, timestamp); + result = compiler_impl::Timestamp::getTimestampPart( + compiler_impl::DatePartSpecifier::CENTURY, timestamp); } }; struct EpochMs { - static inline void operation(int64_t& ms, common::timestamp_t& result) { - result = common::Timestamp::fromEpochMilliSeconds(ms); + static inline void operation(int64_t& ms, + compiler_impl::timestamp_t& result) { + result = compiler_impl::Timestamp::fromEpochMilliSeconds(ms); } }; struct ToTimestamp { - static inline void operation(double& sec, common::timestamp_t& result) { + static inline void operation(double& sec, + compiler_impl::timestamp_t& result) { int64_t ms = 0; - if (!tryCastWithOverflowCheck(sec * common::Interval::MICROS_PER_SEC, ms)) { + if (!tryCastWithOverflowCheck(sec * compiler_impl::Interval::MICROS_PER_SEC, + ms)) { THROW_CONVERSION_EXCEPTION( "Could not convert epoch seconds to TIMESTAMP"); } - result = common::timestamp_t(ms); + result = compiler_impl::timestamp_t(ms); } }; diff --git a/include/neug/compiler/gopt/g_expr_converter.h b/include/neug/compiler/gopt/g_expr_converter.h index 76fd622f2..11e2d209c 100644 --- a/include/neug/compiler/gopt/g_expr_converter.h +++ b/include/neug/compiler/gopt/g_expr_converter.h @@ -127,7 +127,7 @@ class GExprConverter { // helper functions std::unique_ptr<::common::Expression> convertValue( - const neug::common::Value& value); + const compiler_impl::Value& value); std::unique_ptr<::common::Variable> convertVarProperty( const std::string& aliasName, const std::string& propertyName, common::DataType& type); diff --git a/include/neug/compiler/gopt/g_query_converter.h b/include/neug/compiler/gopt/g_query_converter.h index 452f8e6b0..c5f8d3c73 100644 --- a/include/neug/compiler/gopt/g_query_converter.h +++ b/include/neug/compiler/gopt/g_query_converter.h @@ -230,7 +230,7 @@ class GQueryConvertor { std::unique_ptr<::algebra::Range> convertRange( std::shared_ptr skip, std::shared_ptr limit); - uint64_t convertValueAsUint64(common::Value value); + uint64_t convertValueAsUint64(compiler_impl::Value value); std::string getExtensionName(const planner::LogicalCopyTo& copyTo); void convertDataExport(const planner::LogicalCopyTo& copyTo, ::physical::PhysicalPlan* plan); diff --git a/include/neug/compiler/main/client_context.h b/include/neug/compiler/main/client_context.h index 812aee9e1..2e3ce4842 100644 --- a/include/neug/compiler/main/client_context.h +++ b/include/neug/compiler/main/client_context.h @@ -100,7 +100,7 @@ class NEUG_API ClientContext { // Client config const ClientConfig* getClientConfig() const { return &clientConfig; } ClientConfig* getClientConfigUnsafe() { return &clientConfig; } - common::Value getCurrentSetting(const std::string& optionName) const; + compiler_impl::Value getCurrentSetting(const std::string& optionName) const; // TODO: This will be removed after decoupling other dependencies. // Currently returns a dummy `transaction` to maintain compatibility. It will @@ -111,7 +111,7 @@ class NEUG_API ClientContext { const std::string& objectName) const; // Extension - void setExtensionOption(std::string name, common::Value value); + void setExtensionOption(std::string name, compiler_impl::Value value); const main::ExtensionOption* getExtensionOption(std::string optionName) const; MetadataManager* getMetadataManager() const { return localDatabase; } @@ -143,8 +143,8 @@ class NEUG_API ClientContext { std::unique_ptr prepareNoLock( std::shared_ptr parsedStatement, bool shouldCommitNewTransaction, - std::optional< - std::unordered_map>> + std::optional>> inputParams = std::nullopt); // Client side configurable settings. @@ -154,7 +154,7 @@ class NEUG_API ClientContext { // Replace external object as pointer Value; std::vector scanReplacements; // Extension configurable settings. - std::unordered_map extensionOptionValues; + std::unordered_map extensionOptionValues; // Local database. MetadataManager* localDatabase; // Warning information diff --git a/include/neug/compiler/main/kuzu_fwd.h b/include/neug/compiler/main/kuzu_fwd.h index 406642252..1a6c19ba8 100644 --- a/include/neug/compiler/main/kuzu_fwd.h +++ b/include/neug/compiler/main/kuzu_fwd.h @@ -49,9 +49,12 @@ namespace catalog { class Catalog; } // namespace catalog +namespace compiler_impl { +class Value; +} // namespace compiler_impl + namespace common { enum class StatementType : uint8_t; -class Value; struct FileInfo; class VirtualFileSystem; } // namespace common diff --git a/include/neug/compiler/main/option_config.h b/include/neug/compiler/main/option_config.h index 8250714da..645d5072b 100644 --- a/include/neug/compiler/main/option_config.h +++ b/include/neug/compiler/main/option_config.h @@ -34,8 +34,8 @@ class ClientContext; struct SystemConfig; typedef void (*set_context)(ClientContext* context, - const common::Value& parameter); -typedef common::Value (*get_setting)(const ClientContext* context); + const compiler_impl::Value& parameter); +typedef compiler_impl::Value (*get_setting)(const ClientContext* context); enum class OptionType : uint8_t { CONFIGURATION = 0, EXTENSION = 1 }; @@ -68,10 +68,10 @@ struct ConfigurationOption final : Option { }; struct ExtensionOption final : Option { - common::Value defaultValue; + compiler_impl::Value defaultValue; ExtensionOption(std::string name, common::DataTypeId parameterType, - common::Value defaultValue, bool isConfidential) + compiler_impl::Value defaultValue, bool isConfidential) : Option{std::move(name), parameterType, OptionType::EXTENSION, isConfidential}, defaultValue{std::move(defaultValue)} {} diff --git a/include/neug/compiler/main/prepared_statement.h b/include/neug/compiler/main/prepared_statement.h index 8c2a7b799..997fa6d8d 100644 --- a/include/neug/compiler/main/prepared_statement.h +++ b/include/neug/compiler/main/prepared_statement.h @@ -51,7 +51,7 @@ class PreparedStatement { */ NEUG_API bool isReadOnly() const; - std::unordered_map> + std::unordered_map> getParameterMap() { return parameterMap; } @@ -69,7 +69,8 @@ class PreparedStatement { bool readOnly = false; bool useInternalCatalogEntry = false; PreparedSummary preparedSummary; - std::unordered_map> parameterMap; + std::unordered_map> + parameterMap; std::unique_ptr statementResult; std::shared_ptr parsedStatement; }; diff --git a/include/neug/compiler/main/settings.h b/include/neug/compiler/main/settings.h index 3b4f8525c..8d958e7fa 100644 --- a/include/neug/compiler/main/settings.h +++ b/include/neug/compiler/main/settings.h @@ -33,13 +33,13 @@ struct ThreadsSetting { static constexpr auto name = "threads"; static constexpr auto inputType = common::DataTypeId::kUInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->numThreads = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->numThreads); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->numThreads); } }; @@ -47,13 +47,13 @@ struct WarningLimitSetting { static constexpr auto name = "warning_limit"; static constexpr auto inputType = common::DataTypeId::kUInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->warningLimit = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->warningLimit); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->warningLimit); } }; @@ -61,13 +61,13 @@ struct TimeoutSetting { static constexpr auto name = "timeout"; static constexpr auto inputType = common::DataTypeId::kUInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->timeoutInMS = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->timeoutInMS); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->timeoutInMS); } }; @@ -75,9 +75,9 @@ struct ProgressBarSetting { static constexpr auto name = "progress_bar"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) {} - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->enableProgressBar); + const compiler_impl::Value& parameter) {} + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->enableProgressBar); } }; @@ -85,13 +85,13 @@ struct VarLengthExtendMaxDepthSetting { static constexpr auto name = "var_length_extend_max_depth"; static constexpr auto inputType = common::DataTypeId::kInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->varLengthMaxDepth = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->varLengthMaxDepth); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->varLengthMaxDepth); } }; @@ -99,13 +99,14 @@ struct SparseFrontierThresholdSetting { static constexpr auto name = "sparse_frontier_threshold"; static constexpr auto inputType = common::DataTypeId::kInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->sparseFrontierThreshold = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->sparseFrontierThreshold); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value( + context->getClientConfig()->sparseFrontierThreshold); } }; @@ -113,13 +114,13 @@ struct EnableSemiMaskSetting { static constexpr auto name = "enable_semi_mask"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->enableSemiMask = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->enableSemiMask); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->enableSemiMask); } }; @@ -127,13 +128,13 @@ struct DisableMapKeyCheck { static constexpr auto name = "disable_map_key_check"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->disableMapKeyCheck = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->disableMapKeyCheck); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->disableMapKeyCheck); } }; @@ -141,13 +142,13 @@ struct EnableZoneMapSetting { static constexpr auto name = "enable_zone_map"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->enableZoneMap = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value(context->getClientConfig()->enableZoneMap); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(context->getClientConfig()->enableZoneMap); } }; @@ -155,13 +156,13 @@ struct HomeDirectorySetting { static constexpr auto name = "home_directory"; static constexpr auto inputType = common::DataTypeId::kVarchar; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->homeDirectory = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value::createValue( + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value::createValue( context->getClientConfig()->homeDirectory); } }; @@ -170,13 +171,13 @@ struct FileSearchPathSetting { static constexpr auto name = "file_search_path"; static constexpr auto inputType = common::DataTypeId::kVarchar; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->fileSearchPath = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value::createValue( + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value::createValue( context->getClientConfig()->fileSearchPath); } }; @@ -185,16 +186,16 @@ struct RecursivePatternSemanticSetting { static constexpr auto name = "recursive_pattern_semantic"; static constexpr auto inputType = common::DataTypeId::kVarchar; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); const auto input = parameter.getValue(); context->getClientConfigUnsafe()->recursivePatternSemantic = common::PathSemanticUtils::fromString(input); } - static common::Value getSetting(const ClientContext* context) { + static compiler_impl::Value getSetting(const ClientContext* context) { const auto result = common::PathSemanticUtils::toString( context->getClientConfig()->recursivePatternSemantic); - return common::Value::createValue(result); + return compiler_impl::Value::createValue(result); } }; @@ -202,13 +203,13 @@ struct RecursivePatternFactorSetting { static constexpr auto name = "recursive_pattern_factor"; static constexpr auto inputType = common::DataTypeId::kInt64; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->recursivePatternCardinalityScaleFactor = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value::createValue( + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value::createValue( context->getClientConfig()->recursivePatternCardinalityScaleFactor); } }; @@ -217,9 +218,9 @@ struct EnableMVCCSetting { static constexpr auto name = "debug_enable_multi_writes"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) {} - static common::Value getSetting(const ClientContext* context) { - return common::Value(false); + const compiler_impl::Value& parameter) {} + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(false); } }; @@ -227,9 +228,9 @@ struct CheckpointThresholdSetting { static constexpr auto name = "checkpoint_threshold"; static constexpr auto inputType = common::DataTypeId::kInt64; static void setContext(ClientContext* context, - const common::Value& parameter) {} - static common::Value getSetting(const ClientContext* context) { - return common::Value(0); + const compiler_impl::Value& parameter) {} + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(0); } }; @@ -237,9 +238,9 @@ struct AutoCheckpointSetting { static constexpr auto name = "auto_checkpoint"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) {} - static common::Value getSetting(const ClientContext* context) { - return common::Value(false); + const compiler_impl::Value& parameter) {} + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(false); } }; @@ -247,9 +248,9 @@ struct ForceCheckpointClosingDBSetting { static constexpr auto name = "force_checkpoint_on_close"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) {} - static common::Value getSetting(const ClientContext* context) { - return common::Value(false); + const compiler_impl::Value& parameter) {} + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(false); } }; @@ -257,9 +258,9 @@ struct SpillToDiskSetting { static constexpr auto name = "spill_to_disk"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter); - static common::Value getSetting(const ClientContext* context) { - return common::Value(false); + const compiler_impl::Value& parameter); + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value(false); } }; @@ -267,13 +268,13 @@ struct EnableOptimizerSetting { static constexpr auto name = "enable_plan_optimizer"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->enablePlanOptimizer = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value::createValue( + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value::createValue( context->getClientConfig()->enablePlanOptimizer); } }; @@ -282,13 +283,13 @@ struct EnableInternalCatalogSetting { static constexpr auto name = "enable_internal_catalog"; static constexpr auto inputType = common::DataTypeId::kBoolean; static void setContext(ClientContext* context, - const common::Value& parameter) { + const compiler_impl::Value& parameter) { parameter.validateType(inputType); context->getClientConfigUnsafe()->enableInternalCatalog = parameter.getValue(); } - static common::Value getSetting(const ClientContext* context) { - return common::Value::createValue( + static compiler_impl::Value getSetting(const ClientContext* context) { + return compiler_impl::Value::createValue( context->getClientConfig()->enableInternalCatalog); } }; diff --git a/include/neug/compiler/parser/expression/parsed_literal_expression.h b/include/neug/compiler/parser/expression/parsed_literal_expression.h index 9bfd900cf..14798df76 100644 --- a/include/neug/compiler/parser/expression/parsed_literal_expression.h +++ b/include/neug/compiler/parser/expression/parsed_literal_expression.h @@ -33,25 +33,25 @@ class ParsedLiteralExpression : public ParsedExpression { common::ExpressionType::LITERAL; public: - ParsedLiteralExpression(common::Value value, std::string raw) + ParsedLiteralExpression(compiler_impl::Value value, std::string raw) : ParsedExpression{expressionType, std::move(raw)}, value{std::move(value)} {} ParsedLiteralExpression(std::string alias, std::string rawName, - parsed_expr_vector children, common::Value value) + parsed_expr_vector children, compiler_impl::Value value) : ParsedExpression{expressionType, std::move(alias), std::move(rawName), std::move(children)}, value{std::move(value)} {} - explicit ParsedLiteralExpression(common::Value value) + explicit ParsedLiteralExpression(compiler_impl::Value value) : ParsedExpression{expressionType}, value{std::move(value)} {} - common::Value getValue() const { return value; } + compiler_impl::Value getValue() const { return value; } static std::unique_ptr deserialize( common::Deserializer& deserializer) { return std::make_unique( - *common::Value::deserialize(deserializer)); + *compiler_impl::Value::deserialize(deserializer)); } std::unique_ptr copy() const override { @@ -65,7 +65,7 @@ class ParsedLiteralExpression : public ParsedExpression { } private: - common::Value value; + compiler_impl::Value value; }; } // namespace parser diff --git a/include/neug/compiler/processor/operator/persistent/reader/copy_from_error.h b/include/neug/compiler/processor/operator/persistent/reader/copy_from_error.h index f6f09ab94..6c23c85d2 100644 --- a/include/neug/compiler/processor/operator/persistent/reader/copy_from_error.h +++ b/include/neug/compiler/processor/operator/persistent/reader/copy_from_error.h @@ -33,9 +33,6 @@ #include "neug/utils/api.h" namespace neug { -namespace common { -class ValueVector; -} namespace storage { class ColumnChunkData; } diff --git a/include/neug/compiler/processor/warning_context.h b/include/neug/compiler/processor/warning_context.h index bcc3bbfa0..7256ea573 100644 --- a/include/neug/compiler/processor/warning_context.h +++ b/include/neug/compiler/processor/warning_context.h @@ -32,9 +32,6 @@ #include "neug/utils/api.h" namespace neug { -namespace common { -class ValueVector; -} namespace storage { class ColumnChunkData; } diff --git a/include/neug/execution/common/context.h b/include/neug/execution/common/context.h index 78458d473..3d3e0047c 100644 --- a/include/neug/execution/common/context.h +++ b/include/neug/execution/common/context.h @@ -19,16 +19,16 @@ #include #include "neug/common/types.h" -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" +#include "neug/common/types/data_chunk.h" +#include "neug/common/types/i_context_column.h" #include "neug/execution/common/context_chunk.h" -#include "neug/execution/common/data_chunk.h" #include "neug/utils/result.h" namespace neug { class StorageReadInterface; namespace execution { -class IContextColumn; /** * @brief Context is a multi-chunk container passed between operators. diff --git a/include/neug/execution/common/context_chunk.h b/include/neug/execution/common/context_chunk.h index 847029706..f10011784 100644 --- a/include/neug/execution/common/context_chunk.h +++ b/include/neug/execution/common/context_chunk.h @@ -19,7 +19,8 @@ #include #include -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" +#include "neug/common/types/i_context_column.h" namespace neug { diff --git a/include/neug/execution/common/operators/insert/create_edge.h b/include/neug/execution/common/operators/insert/create_edge.h index 7069c0b6b..5ecd979ea 100644 --- a/include/neug/execution/common/operators/insert/create_edge.h +++ b/include/neug/execution/common/operators/insert/create_edge.h @@ -14,13 +14,13 @@ */ #pragma once +#include "neug/common/types/graph_types.h" #include "neug/utils/result.h" namespace neug { class StorageInsertInterface; namespace execution { class ContextChunk; -struct LabelTriplet; class BindedExprBase; namespace ops { class CreateEdge { diff --git a/include/neug/execution/common/operators/retrieve/edge_expand.h b/include/neug/execution/common/operators/retrieve/edge_expand.h index 989c3f267..5ce519d7f 100644 --- a/include/neug/execution/common/operators/retrieve/edge_expand.h +++ b/include/neug/execution/common/operators/retrieve/edge_expand.h @@ -14,10 +14,10 @@ */ #pragma once +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context_chunk.h" #include "neug/execution/common/operators/retrieve/edge_expand_impl.h" #include "neug/execution/common/params_map.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/execution/expression/special_predicates.h" #include "neug/execution/utils/params.h" #include "neug/utils/result.h" diff --git a/include/neug/execution/common/operators/retrieve/edge_expand_impl.h b/include/neug/execution/common/operators/retrieve/edge_expand_impl.h index 1a082bf27..b7ef03ab9 100644 --- a/include/neug/execution/common/operators/retrieve/edge_expand_impl.h +++ b/include/neug/execution/common/operators/retrieve/edge_expand_impl.h @@ -15,8 +15,9 @@ */ #pragma once -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/i_context_column.h" #include "neug/storages/graph/graph_interface.h" namespace neug { diff --git a/include/neug/execution/common/operators/retrieve/get_v.h b/include/neug/execution/common/operators/retrieve/get_v.h index 4d2b9dcfa..90337bfe9 100644 --- a/include/neug/execution/common/operators/retrieve/get_v.h +++ b/include/neug/execution/common/operators/retrieve/get_v.h @@ -14,9 +14,9 @@ */ #pragma once -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/path_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/path_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/context_chunk.h" #include "neug/execution/expression/predicates.h" #include "neug/execution/utils/params.h" diff --git a/include/neug/execution/common/operators/retrieve/join.h b/include/neug/execution/common/operators/retrieve/join.h index a074b2609..fdb88e11a 100644 --- a/include/neug/execution/common/operators/retrieve/join.h +++ b/include/neug/execution/common/operators/retrieve/join.h @@ -14,7 +14,7 @@ */ #pragma once -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/types/graph_types.h" #include "neug/utils/result.h" namespace neug { diff --git a/include/neug/execution/common/operators/retrieve/path_expand_impl.h b/include/neug/execution/common/operators/retrieve/path_expand_impl.h index d2ef2ae7c..bc96e5b5c 100644 --- a/include/neug/execution/common/operators/retrieve/path_expand_impl.h +++ b/include/neug/execution/common/operators/retrieve/path_expand_impl.h @@ -1,4 +1,3 @@ - /** Copyright 2020 Alibaba Group Holding Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +14,10 @@ */ #pragma once -#include "neug/execution/common/columns/path_columns.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/columns/path_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/graph_types.h" #include "neug/storages/graph/graph_interface.h" namespace neug { diff --git a/include/neug/execution/common/operators/retrieve/project.h b/include/neug/execution/common/operators/retrieve/project.h index f125c0c7d..15b8dcc3c 100644 --- a/include/neug/execution/common/operators/retrieve/project.h +++ b/include/neug/execution/common/operators/retrieve/project.h @@ -14,7 +14,6 @@ */ #pragma once -#include "neug/execution/common/columns/i_context_column.h" #include "neug/execution/common/context_chunk.h" #include "neug/execution/common/operators/retrieve/order_by.h" #include "neug/execution/common/params_map.h" diff --git a/include/neug/execution/common/operators/retrieve/scan.h b/include/neug/execution/common/operators/retrieve/scan.h index d1421f799..4398a1430 100644 --- a/include/neug/execution/common/operators/retrieve/scan.h +++ b/include/neug/execution/common/operators/retrieve/scan.h @@ -14,10 +14,10 @@ */ #pragma once -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context_chunk.h" #include "neug/execution/common/params_map.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/expression/special_predicates.h" #include "neug/execution/utils/params.h" #include "neug/storages/graph/graph_interface.h" diff --git a/include/neug/execution/common/params_map.h b/include/neug/execution/common/params_map.h index 4ee138db3..7fbf82ecf 100644 --- a/include/neug/execution/common/params_map.h +++ b/include/neug/execution/common/params_map.h @@ -17,12 +17,13 @@ #include #include +#include "neug/common/types/value.h" + namespace neug { struct DataType; namespace execution { -class Value; using ParamsMap = std::map; using ParamsMetaMap = std::map; } // namespace execution -} // namespace neug \ No newline at end of file +} // namespace neug diff --git a/include/neug/execution/execute/ops/batch/batch_update_utils.h b/include/neug/execution/execute/ops/batch/batch_update_utils.h index c4b1cd8f5..70ba91dec 100644 --- a/include/neug/execution/execute/ops/batch/batch_update_utils.h +++ b/include/neug/execution/execute/ops/batch/batch_update_utils.h @@ -16,6 +16,7 @@ #include +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/utils/property/types.h" @@ -34,9 +35,6 @@ class IDataChunkSupplier; class Schema; class StorageReadInterface; namespace execution { -class VertexRecord; -class EdgeRecord; -struct Path; namespace ops { diff --git a/include/neug/execution/execute/ops/retrieve/order_by_utils.h b/include/neug/execution/execute/ops/retrieve/order_by_utils.h index 3865fb05e..61546332c 100644 --- a/include/neug/execution/execute/ops/retrieve/order_by_utils.h +++ b/include/neug/execution/execute/ops/retrieve/order_by_utils.h @@ -16,13 +16,14 @@ #include -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/i_context_column.h" +#include "neug/common/types/value.h" #include "neug/utils/top_n_generator.h" namespace neug { class StorageReadInterface; namespace execution { -class IVertexColumn; namespace ops { class GeneralComparer { public: diff --git a/include/neug/execution/execute/ops/retrieve/project_utils.h b/include/neug/execution/execute/ops/retrieve/project_utils.h index cb1639e0b..e7da1a618 100644 --- a/include/neug/execution/execute/ops/retrieve/project_utils.h +++ b/include/neug/execution/execute/ops/retrieve/project_utils.h @@ -14,8 +14,8 @@ */ #pragma once -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/operators/retrieve/project.h" #include "neug/execution/execute/ops/retrieve/order_by_utils.h" #include "neug/execution/expression/expr.h" diff --git a/include/neug/execution/execute/ops/retrieve/scan_utils.h b/include/neug/execution/execute/ops/retrieve/scan_utils.h index c852d6dc7..a87994685 100644 --- a/include/neug/execution/execute/ops/retrieve/scan_utils.h +++ b/include/neug/execution/execute/ops/retrieve/scan_utils.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/execute/operator.h" #include "neug/utils/property/types.h" diff --git a/include/neug/execution/expression/expr.h b/include/neug/execution/expression/expr.h index 0f3b00cce..3b2840df1 100644 --- a/include/neug/execution/expression/expr.h +++ b/include/neug/execution/expression/expr.h @@ -18,7 +18,6 @@ #include "neug/common/types.h" #include "neug/execution/common/context.h" #include "neug/execution/common/params_map.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/graph/graph_interface.h" namespace neug { diff --git a/include/neug/execution/expression/special_predicates.h b/include/neug/execution/expression/special_predicates.h index 8c537ac6a..bcc6112db 100644 --- a/include/neug/execution/expression/special_predicates.h +++ b/include/neug/execution/expression/special_predicates.h @@ -15,7 +15,6 @@ */ #pragma once -#include "neug/execution/common/types/value.h" #include "neug/execution/utils/pb_parse_utils.h" #include "neug/execution/common/context.h" diff --git a/include/neug/execution/utils/params.h b/include/neug/execution/utils/params.h index 3c0869fa4..85cac18b3 100644 --- a/include/neug/execution/utils/params.h +++ b/include/neug/execution/utils/params.h @@ -17,7 +17,7 @@ #include #include -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/types/graph_types.h" namespace neug { namespace execution { diff --git a/include/neug/execution/utils/pb_parse_utils.h b/include/neug/execution/utils/pb_parse_utils.h index 88d5a2332..6135f0788 100644 --- a/include/neug/execution/utils/pb_parse_utils.h +++ b/include/neug/execution/utils/pb_parse_utils.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/types/graph_types.h" #include "neug/generated/proto/plan/physical.pb.h" #include "neug/utils/encoder.h" diff --git a/include/neug/main/connection.h b/include/neug/main/connection.h index 6d4a94d3c..8aac09662 100644 --- a/include/neug/main/connection.h +++ b/include/neug/main/connection.h @@ -21,8 +21,8 @@ #include #include +#include "neug/common/types/value.h" #include "neug/compiler/planner/graph_planner.h" -#include "neug/execution/common/types/value.h" #include "neug/generated/proto/plan/physical.pb.h" #include "neug/main/query_processor.h" #include "neug/main/query_result.h" @@ -104,7 +104,7 @@ class Connection { * * // Query with parameters * neug::execution::ParamsMap params; - * params["min_age"] = neug::execution::Value(18); + * params["min_age"] = neug::Value(18); * result = conn->Query("MATCH (p:Person) WHERE p.age > $min_age RETURN p", * "read", params); * diff --git a/include/neug/main/query_processor.h b/include/neug/main/query_processor.h index 8e96dd94a..04a1863d1 100644 --- a/include/neug/main/query_processor.h +++ b/include/neug/main/query_processor.h @@ -23,9 +23,9 @@ #include #include +#include "neug/common/types/value.h" #include "neug/compiler/planner/graph_planner.h" #include "neug/execution/common/params_map.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/execute/query_cache.h" #include "neug/execution/utils/opr_timer.h" #include "neug/generated/proto/plan/physical.pb.h" diff --git a/include/neug/main/query_request.h b/include/neug/main/query_request.h index c4b058c72..cbc9e1fc7 100644 --- a/include/neug/main/query_request.h +++ b/include/neug/main/query_request.h @@ -18,8 +18,8 @@ #include #include +#include "neug/common/types/value.h" #include "neug/execution/common/params_map.h" -#include "neug/execution/common/types/value.h" #include "neug/utils/access_mode.h" #include "neug/utils/result.h" diff --git a/include/neug/storages/csr/csr_base.h b/include/neug/storages/csr/csr_base.h index ea5578e72..dbaed6c0a 100644 --- a/include/neug/storages/csr/csr_base.h +++ b/include/neug/storages/csr/csr_base.h @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/csr/csr_view.h" #include "neug/storages/csr/nbr.h" @@ -81,7 +81,7 @@ class CsrBase : public Module { timestamp_t ts) = 0; virtual std::pair put_generic_edge( - vid_t src, vid_t dst, const execution::Value& data, timestamp_t ts, + vid_t src, vid_t dst, const Value& data, timestamp_t ts, Allocator& alloc) = 0; virtual std::tuple, std::vector> batch_export( @@ -112,7 +112,7 @@ class TypedCsrBase : public CsrBase { } std::pair put_generic_edge(vid_t src, vid_t dst, - const execution::Value& data, + const Value& data, timestamp_t ts, Allocator& alloc) override { return this->put_edge(src, dst, data.GetValue(), ts, alloc); diff --git a/include/neug/storages/csr/csr_view.h b/include/neug/storages/csr/csr_view.h index a87207320..659bfdb52 100644 --- a/include/neug/storages/csr/csr_view.h +++ b/include/neug/storages/csr/csr_view.h @@ -16,7 +16,7 @@ #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/csr/nbr.h" #include "neug/storages/csr/prefetch_utils.h" #include "neug/utils/property/column.h" @@ -253,8 +253,8 @@ static_assert(std::is_pod::value, "NbrList should be POD"); * NbrList edges = view.get_edges(v); * * for (auto it = edges.begin(); it != edges.end(); ++it) { - * // Get property as generic execution::Value - * execution::Value val = accessor.get_value(it); + * // Get property as generic Value + * Value val = accessor.get_value(it); * * // Or get as typed value (faster if type is known) * double weight = accessor.get_typed_data(it); @@ -308,25 +308,25 @@ struct EdgeDataAccessor { } /** - * @brief Get property value for current edge as execution::Value. + * @brief Get property value for current edge as Value. * @param it Iterator pointing to the edge - * @return execution::Value containing the edge data + * @return Value containing the edge data */ - inline execution::Value get_data(const NbrIterator& it) const { + inline Value get_data(const NbrIterator& it) const { return data_column_ == nullptr ? get_generic_bundled_data_from_ptr(it.get_data_ptr()) : data_column_->get_any( *reinterpret_cast(it.get_data_ptr())); } - inline execution::Value get_data_from_ptr(const void* data_ptr) const { + inline Value get_data_from_ptr(const void* data_ptr) const { return data_column_ == nullptr ? get_generic_bundled_data_from_ptr(data_ptr) : data_column_->get_any( *reinterpret_cast(data_ptr)); } - inline void set_data(const NbrIterator& it, const execution::Value& value, + inline void set_data(const NbrIterator& it, const Value& value, timestamp_t ts) { if (it.cfg.ts_offset != 0) { *const_cast(it.get_timestamp_ptr()) = ts; @@ -366,15 +366,14 @@ struct EdgeDataAccessor { return reinterpret_cast*>(data_column_)->get_view(idx); } - inline execution::Value get_generic_bundled_data_from_ptr( - const void* data_ptr) const { + inline Value get_generic_bundled_data_from_ptr(const void* data_ptr) const { if (data_type_ == DataTypeId::kEmpty) { - return execution::Value(DataType::EMPTY); + return Value(DataType::EMPTY); } switch (data_type_) { #define TYPE_DISPATCHER(enum_val, type) \ case DataTypeId::enum_val: { \ - return execution::Value::CreateValue( \ + return Value::CreateValue( \ get_bundled_data_from_ptr(data_ptr)); \ } FOR_EACH_DATA_TYPE_NO_STRING(TYPE_DISPATCHER) @@ -382,7 +381,7 @@ struct EdgeDataAccessor { default: THROW_RUNTIME_ERROR("Could not get bundled data for type " + std::to_string(data_type_)); - return execution::Value(DataType::SQLNULL); + return Value(DataType::SQLNULL); } } diff --git a/include/neug/storages/csr/csr_view_utils.h b/include/neug/storages/csr/csr_view_utils.h index 7db785536..3609cd576 100644 --- a/include/neug/storages/csr/csr_view_utils.h +++ b/include/neug/storages/csr/csr_view_utils.h @@ -18,9 +18,6 @@ namespace neug { -namespace execution { -class EdgeRecord; -} // namespace execution enum class DataTypeId : uint8_t; class Property; @@ -30,8 +27,7 @@ int32_t fuzzy_search_offset_from_nbr_list(const NbrList& nbr_list, const DataTypeId& type); std::pair record_to_csr_offset_pair( - const CsrView& oe, const CsrView& ie, - const neug::execution::EdgeRecord& record, + const CsrView& oe, const CsrView& ie, const EdgeRecord& record, const std::vector& props); int32_t search_other_offset_with_cur_offset(const CsrView& cur_view, diff --git a/include/neug/storages/graph/edge_table.h b/include/neug/storages/graph/edge_table.h index ae743dfad..56ac97a6a 100644 --- a/include/neug/storages/graph/edge_table.h +++ b/include/neug/storages/graph/edge_table.h @@ -23,7 +23,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/csr/csr_base.h" @@ -136,24 +136,23 @@ class EdgeTable { std::shared_ptr supplier); // Add edges in batch to the edge table. - void BatchAddEdges( - const std::vector& src_lid_list, - const std::vector& dst_lid_list, - const std::vector>& edge_data_list); + void BatchAddEdges(const std::vector& src_lid_list, + const std::vector& dst_lid_list, + const std::vector>& edge_data_list); // Add a single edge to the edge table. Note this method requires an Allocator // to allocate memory for the edge data. Should be called in tp mode. - std::pair AddEdge( - vid_t src_lid, vid_t dst_lid, - const std::vector& properties, timestamp_t ts, - Allocator& alloc, bool insert_safe); + std::pair AddEdge(vid_t src_lid, vid_t dst_lid, + const std::vector& properties, + timestamp_t ts, Allocator& alloc, + bool insert_safe); void RenameProperties(const std::vector& old_names, const std::vector& new_names); void AddProperties(Checkpoint& ckp, const std::vector& names, const std::vector& types, - const std::vector& default_values = {}); + const std::vector& default_values = {}); void DeleteProperties(Checkpoint& ckp, const std::vector& col_names); @@ -171,7 +170,7 @@ class EdgeTable { void UpdateEdgeProperty(vid_t src_lid, vid_t dst_lid, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& new_prop, timestamp_t ts); + const Value& new_prop, timestamp_t ts); void Compact(const std::optional& sort_key_for_nbr, timestamp_t ts); @@ -213,8 +212,8 @@ template std::pair insert_edge_into_csr_internal( CsrBase& out_csr, CsrBase& in_csr, TABLE& table, std::atomic& table_idx, const EdgeSchema& meta, vid_t src_lid, - vid_t dst_lid, const std::vector& properties, - timestamp_t ts, Allocator& alloc, bool insert_safe) { + vid_t dst_lid, const std::vector& properties, timestamp_t ts, + Allocator& alloc, bool insert_safe) { int32_t oe_offset; const void* data_ptr = nullptr; if (meta.is_bundled()) { @@ -222,8 +221,8 @@ std::pair insert_edge_into_csr_internal( properties.size() == 1 || (properties.size() == 0 && (meta.properties.empty() || meta.properties[0] == DataTypeId::kEmpty))); - execution::Value bundled_data = - properties.empty() ? execution::Value(DataType::EMPTY) : properties[0]; + Value bundled_data = + properties.empty() ? Value(DataType::EMPTY) : properties[0]; in_csr.put_generic_edge(dst_lid, src_lid, bundled_data, ts, alloc); auto out_ret = out_csr.put_generic_edge(src_lid, dst_lid, bundled_data, ts, alloc); @@ -235,7 +234,7 @@ std::pair insert_edge_into_csr_internal( "edge data size not match edge table property size"); } size_t row_id = table_idx.fetch_add(1); - execution::Value prop = execution::Value::UINT64(row_id); + Value prop = Value::UINT64(row_id); in_csr.put_generic_edge(dst_lid, src_lid, prop, ts, alloc); auto out_ret = out_csr.put_generic_edge(src_lid, dst_lid, prop, ts, alloc); oe_offset = out_ret.first; diff --git a/include/neug/storages/graph/graph_interface.h b/include/neug/storages/graph/graph_interface.h index 58438a996..9ec56cec9 100644 --- a/include/neug/storages/graph/graph_interface.h +++ b/include/neug/storages/graph/graph_interface.h @@ -16,8 +16,8 @@ #include -#include "neug/execution/common/columns/container_types.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/container_types.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/graph_view.h" #include "neug/storages/graph/property_graph.h" #include "neug/storages/graph/schema.h" @@ -89,7 +89,7 @@ class IStorageInterface { * @param index Output parameter for internal vertex index * @return true if vertex found, false otherwise */ - virtual bool GetVertexIndex(label_t label, const execution::Value& id, + virtual bool GetVertexIndex(label_t label, const Value& id, vid_t& index) const = 0; }; @@ -200,7 +200,7 @@ class StorageReadInterface : virtual public IStorageInterface { return view_.GetVertexSet(label, read_ts_); } - bool GetVertexIndex(label_t label, const execution::Value& id, + bool GetVertexIndex(label_t label, const Value& id, vid_t& index) const override { return view_.get_lid(label, id, index, read_ts_); } @@ -223,11 +223,11 @@ class StorageReadInterface : virtual public IStorageInterface { * * @param label Vertex label * @param index Internal vertex ID - * @return execution::Value containing the primary key value + * @return Value containing the primary key value * * @since v0.1.0 */ - inline execution::Value GetVertexId(label_t label, vid_t index) const { + inline Value GetVertexId(label_t label, vid_t index) const { return view_.GetOid(label, index, read_ts_); } @@ -236,21 +236,21 @@ class StorageReadInterface : virtual public IStorageInterface { * * **Usage Example:** * @code{.cpp} - * execution::Value age = reader.GetVertexProperty(person_label, vid, + * Value age = reader.GetVertexProperty(person_label, vid, * age_prop_id); int64_t age_val = age.GetValue(); * @endcode * * @param label Vertex label * @param index Internal vertex ID * @param prop_id Property column index - * @return execution::Value containing the value + * @return Value containing the value * * @since v0.1.0 */ - inline execution::Value GetVertexProperty(label_t label, vid_t index, - int prop_id) const { + inline Value GetVertexProperty(label_t label, vid_t index, + int prop_id) const { auto col = view_.GetVertexPropertyColumn(label, prop_id); - return col ? col->get_any(index) : execution::Value(); + return col ? col->get_any(index) : Value(); } /** @@ -398,9 +398,8 @@ class StorageInsertInterface : virtual public IStorageInterface { * @return Status::OK() on success, or an error Status if validation fails * (e.g. property count/type mismatch, capacity failure). */ - virtual Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& vid) = 0; + virtual Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) = 0; /** * @brief Add a single edge to the graph. @@ -419,7 +418,7 @@ class StorageInsertInterface : virtual public IStorageInterface { */ virtual Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, - const std::vector& properties, + const std::vector& properties, const void*& prop) = 0; /** @@ -510,7 +509,7 @@ class StorageUpdateInterface : public StorageReadInterface, * @param value New property value */ virtual Status UpdateVertexProperty(label_t label, vid_t lid, int col_id, - const execution::Value& value) = 0; + const Value& value) = 0; /** * @brief Update an edge property value. @@ -529,14 +528,14 @@ class StorageUpdateInterface : public StorageReadInterface, label_t dst_label, vid_t dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& value) = 0; + const Value& value) = 0; - virtual Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, + virtual Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) override = 0; virtual Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, - const std::vector& properties, + const std::vector& properties, const void*& prop) override = 0; /** @@ -629,17 +628,15 @@ class StorageAPUpdateInterface : public StorageUpdateInterface { ~StorageAPUpdateInterface() {} Status UpdateVertexProperty(label_t label, vid_t lid, int col_id, - const execution::Value& value) override; + const Value& value) override; Status UpdateEdgeProperty(label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& value) override; - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& vid) override; + const Value& value) override; + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) override; Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, - label_t edge_label, - const std::vector& properties, + label_t edge_label, const std::vector& properties, const void*& prop) override; Status DeleteVertex(label_t label, vid_t lid) override; Status DeleteEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, diff --git a/include/neug/storages/graph/graph_view.h b/include/neug/storages/graph/graph_view.h index 14f942c63..7745d42dd 100644 --- a/include/neug/storages/graph/graph_view.h +++ b/include/neug/storages/graph/graph_view.h @@ -42,8 +42,7 @@ class TableView { // Note: insert_safe is kept for compatibility with the old interface. // It must be false for TableView. - void insert(size_t index, const std::vector& values, - bool insert_safe); + void insert(size_t index, const std::vector& values, bool insert_safe); private: const std::unordered_map* col_id_map_{nullptr}; @@ -55,17 +54,16 @@ class VertexTableView { VertexTableView() = default; explicit VertexTableView(VertexTable& table); - bool get_lid(const execution::Value& oid, vid_t& lid, timestamp_t ts) const; + bool get_lid(const Value& oid, vid_t& lid, timestamp_t ts) const; vid_t LidNum() const; bool IsValidLid(vid_t lid, timestamp_t ts) const; - execution::Value GetOid(vid_t lid, timestamp_t ts) const; + Value GetOid(vid_t lid, timestamp_t ts) const; VertexSet GetVertexSet(timestamp_t ts) const; std::shared_ptr GetPropertyColumn(int col_id) const; std::shared_ptr GetPropertyColumn( const std::string& prop) const; - bool AddVertex(const execution::Value& id, - const std::vector& props, vid_t& ret, + bool AddVertex(const Value& id, const std::vector& props, vid_t& ret, timestamp_t ts, bool insert_safe); private: @@ -86,10 +84,10 @@ class EdgeTableView { EdgeDataAccessor GetDataAccessor(int prop_id) const; EdgeDataAccessor GetDataAccessor(const std::string& prop_name) const; - std::pair AddEdge( - vid_t src_lid, vid_t dst_lid, - const std::vector& properties, timestamp_t ts, - Allocator& alloc, bool insert_safe); + std::pair AddEdge(vid_t src_lid, vid_t dst_lid, + const std::vector& properties, + timestamp_t ts, Allocator& alloc, + bool insert_safe); private: std::shared_ptr meta_; @@ -114,7 +112,7 @@ class GraphView { const Schema& schema() const { return *schema_; } - inline bool get_lid(label_t label, const execution::Value& oid, vid_t& lid, + inline bool get_lid(label_t label, const Value& oid, vid_t& lid, timestamp_t ts) const { return vertex_views_[label].get_lid(oid, lid, ts); } @@ -134,7 +132,7 @@ class GraphView { } VertexSet GetVertexSet(label_t label, timestamp_t ts) const; - execution::Value GetOid(label_t label, vid_t lid, timestamp_t ts) const; + Value GetOid(label_t label, vid_t lid, timestamp_t ts) const; CsrView GetGenericOutgoingView(label_t src_label, label_t dst_label, label_t edge_label, timestamp_t ts) const; @@ -146,15 +144,13 @@ class GraphView { label_t edge_label, const std::string& prop_name) const; - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, vid_t& vid, - timestamp_t ts); + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid, timestamp_t ts); Status AddEdge(label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, label_t edge_label, - const std::vector& properties, - timestamp_t ts, Allocator& alloc, int32_t& oe_offset, - const void*& prop); + const std::vector& properties, timestamp_t ts, + Allocator& alloc, int32_t& oe_offset, const void*& prop); void Rebuild(PropertyGraph& pg); diff --git a/include/neug/storages/graph/operation_params.h b/include/neug/storages/graph/operation_params.h index 3fd5c3664..44ffebd2f 100644 --- a/include/neug/storages/graph/operation_params.h +++ b/include/neug/storages/graph/operation_params.h @@ -18,7 +18,7 @@ #include #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/property/types.h" namespace neug { @@ -28,7 +28,7 @@ class OutArchive; class CreateVertexTypeParam { private: std::string vertex_label_name; - std::vector> properties; + std::vector> properties; std::vector primary_key_names; bool temporary = false; CreateVertexTypeParam() = default; @@ -36,8 +36,7 @@ class CreateVertexTypeParam { public: const std::string& GetVertexLabel() const { return vertex_label_name; } - const std::vector>& GetProperties() - const { + const std::vector>& GetProperties() const { return properties; } const std::vector& GetPrimaryKeyNames() const { @@ -60,13 +59,13 @@ class CreateVertexTypeParamBuilder { } CreateVertexTypeParamBuilder& Properties( - const std::vector>& properties) { + const std::vector>& properties) { config.properties = properties; return *this; } CreateVertexTypeParamBuilder& AddProperty(const std::string& name, - const execution::Value& value) { + const Value& value) { config.properties.emplace_back(name, value); return *this; } @@ -106,7 +105,7 @@ class CreateEdgeTypeParam { std::string src_label_name; std::string dst_label_name; std::string edge_label_name; - std::vector> properties; + std::vector> properties; EdgeStrategy oe_edge_strategy; EdgeStrategy ie_edge_strategy; std::optional sort_key_for_nbr; @@ -118,8 +117,7 @@ class CreateEdgeTypeParam { const std::string& GetSrcLabel() const { return src_label_name; } const std::string& GetDstLabel() const { return dst_label_name; } const std::string& GetEdgeLabel() const { return edge_label_name; } - const std::vector>& GetProperties() - const { + const std::vector>& GetProperties() const { return properties; } EdgeStrategy GetOEEdgeStrategy() const { return oe_edge_strategy; } @@ -157,13 +155,13 @@ class CreateEdgeTypeParamBuilder { } CreateEdgeTypeParamBuilder& Properties( - const std::vector>& properties) { + const std::vector>& properties) { config.properties = properties; return *this; } CreateEdgeTypeParamBuilder& AddProperty(const std::string& name, - const execution::Value& value) { + const Value& value) { config.properties.emplace_back(name, value); return *this; } @@ -209,14 +207,13 @@ class CreateEdgeTypeParamBuilder { class AddVertexPropertiesParam { private: std::string vertex_label_name; - std::vector> properties; + std::vector> properties; AddVertexPropertiesParam() = default; friend class AddVertexPropertiesParamBuilder; public: const std::string& GetVertexLabel() const { return vertex_label_name; } - const std::vector>& GetProperties() - const { + const std::vector>& GetProperties() const { return properties; } @@ -235,13 +232,13 @@ class AddVertexPropertiesParamBuilder { } AddVertexPropertiesParamBuilder& Properties( - const std::vector>& properties) { + const std::vector>& properties) { config.properties = properties; return *this; } AddVertexPropertiesParamBuilder& AddProperty(const std::string& name, - const execution::Value& value) { + const Value& value) { config.properties.emplace_back(name, value); return *this; } @@ -260,7 +257,7 @@ class AddEdgePropertiesParam { std::string src_label_name; std::string dst_label_name; std::string edge_label_name; - std::vector> properties; + std::vector> properties; AddEdgePropertiesParam() = default; friend class AddEdgePropertiesParamBuilder; @@ -268,8 +265,7 @@ class AddEdgePropertiesParam { const std::string& GetSrcLabel() const { return src_label_name; } const std::string& GetDstLabel() const { return dst_label_name; } const std::string& GetEdgeLabel() const { return edge_label_name; } - const std::vector>& GetProperties() - const { + const std::vector>& GetProperties() const { return properties; } @@ -298,13 +294,13 @@ class AddEdgePropertiesParamBuilder { } AddEdgePropertiesParamBuilder& Properties( - const std::vector>& properties) { + const std::vector>& properties) { config.properties = properties; return *this; } AddEdgePropertiesParamBuilder& AddProperty(const std::string& name, - const execution::Value& value) { + const Value& value) { config.properties.emplace_back(name, value); return *this; } diff --git a/include/neug/storages/graph/property_graph.h b/include/neug/storages/graph/property_graph.h index bbfce7629..5543ac7a9 100644 --- a/include/neug/storages/graph/property_graph.h +++ b/include/neug/storages/graph/property_graph.h @@ -27,7 +27,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/checkpoint.h" #include "neug/storages/checkpoint_manager.h" @@ -42,10 +42,6 @@ namespace neug { -namespace execution { -class EdgeRecord; -} - /** * @brief Core property graph storage engine for vertices, edges, and schema. * @@ -321,8 +317,7 @@ class PropertyGraph { * @return true if deletion is successful, false otherwise. * @note We always delete vertex in detach mode. */ - Status DeleteVertex(label_t v_label, const execution::Value& oid, - timestamp_t ts); + Status DeleteVertex(label_t v_label, const Value& oid, timestamp_t ts); Status DeleteVertex(label_t v_label, vid_t lid, timestamp_t ts); Status DeleteEdge(label_t src_label, vid_t src_lid, label_t dst_label, @@ -387,28 +382,28 @@ class PropertyGraph { size_t EdgeNum(label_t src_label, label_t edge_label, label_t dst_label) const; - bool get_lid(label_t label, const execution::Value& oid, vid_t& lid, + bool get_lid(label_t label, const Value& oid, vid_t& lid, timestamp_t ts) const; - execution::Value GetOid(label_t label, vid_t lid, timestamp_t ts) const; + Value GetOid(label_t label, vid_t lid, timestamp_t ts) const; - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, vid_t& vid, - timestamp_t ts, bool insert_safe = false); + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid, timestamp_t ts, + bool insert_safe = false); Status AddEdge(label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, label_t edge_label, - const std::vector& properties, - timestamp_t ts, Allocator& alloc, int32_t& oe_offset, - const void*& prop, bool insert_safe = false); + const std::vector& properties, timestamp_t ts, + Allocator& alloc, int32_t& oe_offset, const void*& prop, + bool insert_safe = false); Status UpdateVertexProperty(label_t v_label, vid_t vid, int32_t prop_id, - const execution::Value& value, timestamp_t ts); + const Value& value, timestamp_t ts); Status UpdateEdgeProperty(label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, label_t e_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& new_prop, timestamp_t ts); + const Value& new_prop, timestamp_t ts); /** * @brief Get a view for traversing outgoing edges. diff --git a/include/neug/storages/graph/schema.h b/include/neug/storages/graph/schema.h index fd3684bae..7ee958e1c 100644 --- a/include/neug/storages/graph/schema.h +++ b/include/neug/storages/graph/schema.h @@ -25,7 +25,7 @@ #include #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/bitset.h" #include "neug/utils/property/default_value.h" #include "neug/utils/property/types.h" @@ -107,15 +107,14 @@ struct VertexSchema { * * @since v0.1.0 */ - VertexSchema( - const std::string& label_name_, - const std::vector& property_types_, - const std::vector& property_names_, - const std::vector>& - primary_keys_, - const std::vector& default_property_values_ = {}, - const std::string& description_ = "", - size_t max_num_ = static_cast(1) << 32) + VertexSchema(const std::string& label_name_, + const std::vector& property_types_, + const std::vector& property_names_, + const std::vector>& + primary_keys_, + const std::vector& default_property_values_ = {}, + const std::string& description_ = "", + size_t max_num_ = static_cast(1) << 32) : label_name(label_name_), property_types(property_types_), property_names(property_names_), @@ -140,10 +139,10 @@ struct VertexSchema { void add_properties(const std::vector& names, const std::vector& types, - const std::vector& default_values = {}); + const std::vector& default_values = {}); void set_properties(const std::vector& types, - const std::vector& default_values = {}); + const std::vector& default_values = {}); void rename_properties(const std::vector& names, const std::vector& renames); @@ -167,7 +166,7 @@ struct VertexSchema { bool has_property(const std::string& prop) const; - const std::vector& get_default_property_values() const { + const std::vector& get_default_property_values() const { return default_property_values; } @@ -178,7 +177,7 @@ struct VertexSchema { std::vector property_names; // std::vector> primary_keys; - std::vector default_property_values; + std::vector default_property_values; std::string description; size_t max_num; @@ -257,7 +256,7 @@ struct EdgeSchema { EdgeStrategy ie_strategy_, const std::vector& properties_, const std::vector& property_names_, - const std::vector& default_property_values_ = {}) + const std::vector& default_property_values_ = {}) : src_label_name(src_label_name_), dst_label_name(dst_label_name_), edge_label_name(edge_label_name_), @@ -289,7 +288,7 @@ struct EdgeSchema { void add_properties(const std::vector& names, const std::vector& types, - const std::vector& default_values = {}); + const std::vector& default_values = {}); void rename_properties(const std::vector& names, const std::vector& renames); @@ -303,7 +302,7 @@ struct EdgeSchema { int32_t get_property_index(const std::string& prop) const; - const std::vector& get_default_property_values() const { + const std::vector& get_default_property_values() const { return default_property_values; } @@ -316,7 +315,7 @@ struct EdgeSchema { EdgeStrategy ie_strategy; std::vector properties; std::vector property_names; - std::vector default_property_values; + std::vector default_property_values; // Mark whether the edge property is soft deleted std::vector eprop_soft_deleted; @@ -464,20 +463,20 @@ class Schema { const std::vector>& primary_key, size_t max_vnum = static_cast(1) << 32, const std::string& description = "", - const std::vector& default_property_values = {}, + const std::vector& default_property_values = {}, bool temporary = false); - void AddEdgeLabel( - const std::string& src_label, const std::string& dst_label, - const std::string& edge_label, const std::vector& properties, - const std::vector& prop_names, - EdgeStrategy oe = EdgeStrategy::kMultiple, - EdgeStrategy ie = EdgeStrategy::kMultiple, bool oe_mutable = true, - bool ie_mutable = true, - std::optional sort_key_for_nbr = std::nullopt, - const std::string& description = "", - const std::vector& default_property_values = {}, - bool temporary = false); + void AddEdgeLabel(const std::string& src_label, const std::string& dst_label, + const std::string& edge_label, + const std::vector& properties, + const std::vector& prop_names, + EdgeStrategy oe = EdgeStrategy::kMultiple, + EdgeStrategy ie = EdgeStrategy::kMultiple, + bool oe_mutable = true, bool ie_mutable = true, + std::optional sort_key_for_nbr = std::nullopt, + const std::string& description = "", + const std::vector& default_property_values = {}, + bool temporary = false); bool is_vertex_label_temporary(label_t label) const; bool is_edge_label_temporary(uint32_t edge_triplet_key) const; @@ -496,18 +495,17 @@ class Schema { void DeleteEdgeLabel(const std::string& src, const std::string& dst, const std::string& edge, bool is_soft = false); - void AddVertexProperties( - const std::string& label, - const std::vector& properties_names, - const std::vector& properties_types, - const std::vector& properties_default_values); + void AddVertexProperties(const std::string& label, + const std::vector& properties_names, + const std::vector& properties_types, + const std::vector& properties_default_values); - void AddEdgeProperties( - const std::string& src_label, const std::string& dst_label, - const std::string& edge_label, - const std::vector& properties_names, - const std::vector& properties_types, - const std::vector& properties_default_values); + void AddEdgeProperties(const std::string& src_label, + const std::string& dst_label, + const std::string& edge_label, + const std::vector& properties_names, + const std::vector& properties_types, + const std::vector& properties_default_values); void RenameVertexProperties( const std::string& label, @@ -560,7 +558,7 @@ class Schema { void set_vertex_properties( label_t label_id, const std::vector& types, - const std::vector& default_property_values = {}); + const std::vector& default_property_values = {}); std::vector get_vertex_properties(const std::string& label) const; std::vector get_vertex_properties_id( @@ -569,7 +567,7 @@ class Schema { std::vector get_vertex_properties(label_t label) const; std::vector get_vertex_properties_id(label_t label) const; - const std::vector& get_vertex_default_property_values( + const std::vector& get_vertex_default_property_values( label_t label) const; std::vector get_vertex_property_names( @@ -590,7 +588,7 @@ class Schema { bool is_edge_triplet_valid(label_type src_label, label_type dst_label, label_type edge_label) const; - const std::vector& get_edge_default_property_values( + const std::vector& get_edge_default_property_values( label_t src_label_id, label_t dst_label_id, label_t edge_label_id) const; std::vector get_edge_properties(const std::string& src_label, diff --git a/include/neug/storages/graph/vertex_table.h b/include/neug/storages/graph/vertex_table.h index bbfe98b21..9e9f4ed59 100644 --- a/include/neug/storages/graph/vertex_table.h +++ b/include/neug/storages/graph/vertex_table.h @@ -14,7 +14,7 @@ */ #pragma once -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/schema.h" #include "neug/storages/graph/vertex_timestamp.h" #include "neug/storages/loader/loader_utils.h" @@ -182,17 +182,16 @@ class VertexTable { size_t EnsureCapacity(size_t capacity); - bool get_index(const execution::Value& oid, vid_t& lid, + bool get_index(const Value& oid, vid_t& lid, timestamp_t ts = MAX_TIMESTAMP) const; - execution::Value GetOid(vid_t lid, timestamp_t ts = MAX_TIMESTAMP) const; + Value GetOid(vid_t lid, timestamp_t ts = MAX_TIMESTAMP) const; // Return false if the reserved space is not enough. - bool AddVertex(const execution::Value& id, - const std::vector& props, vid_t& vid, + bool AddVertex(const Value& id, const std::vector& props, vid_t& vid, timestamp_t ts, bool insert_safe); - bool UpdateProperty(vid_t vid, int32_t prop_id, const execution::Value& value, + bool UpdateProperty(vid_t vid, int32_t prop_id, const Value& value, timestamp_t ts); size_t VertexNum(timestamp_t ts = MAX_TIMESTAMP) const; @@ -238,16 +237,16 @@ class VertexTable { void BatchDeleteVertices(const std::vector& vids); - void DeleteVertex(const execution::Value& id, timestamp_t ts); + void DeleteVertex(const Value& id, timestamp_t ts); void DeleteVertex(vid_t lid, timestamp_t ts); void RevertDeleteVertex(vid_t lid, timestamp_t ts); - void AddProperties( - Checkpoint& ckp, const std::vector& property_names, - const std::vector& property_types, - const std::vector& default_property_values); + void AddProperties(Checkpoint& ckp, + const std::vector& property_names, + const std::vector& property_types, + const std::vector& default_property_values); void DeleteProperties(const std::vector& properties); @@ -264,11 +263,10 @@ class VertexTable { Table& get_table() { return *table_; } private: - vid_t insert_vertex_pk(const execution::Value& id, timestamp_t ts, - bool insert_safe); + vid_t insert_vertex_pk(const Value& id, timestamp_t ts, bool insert_safe); template std::vector insert_primary_keys( - const std::shared_ptr& pk_col) { + const std::shared_ptr& pk_col) { size_t row_num = pk_col->size(); std::vector vids; vids.resize(row_num); @@ -320,7 +318,7 @@ class VertexTable { auto pk_col = columns[ind]; // Build a list of property columns excluding the PK column. - std::vector> prop_cols; + std::vector> prop_cols; prop_cols.reserve(columns.size() - 1); for (size_t i = 0; i < columns.size(); ++i) { if (static_cast(i) != ind) { @@ -364,7 +362,7 @@ class VertexTable { namespace internal { vid_t insert_vertex_pk_internal(IndexerType& indexer, VertexTimestamp& v_ts, - const execution::Value& id, timestamp_t ts, + const Value& id, timestamp_t ts, bool insert_safe); } // namespace internal diff --git a/include/neug/storages/loader/loader_utils.h b/include/neug/storages/loader/loader_utils.h index a1c01dd4e..87af7fa17 100644 --- a/include/neug/storages/loader/loader_utils.h +++ b/include/neug/storages/loader/loader_utils.h @@ -24,7 +24,8 @@ #include #include -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" +#include "neug/common/types/i_context_column.h" #include "neug/storages/loader/loading_config.h" #include "neug/utils/exception/exception.h" #include "neug/utils/io/read/csv/csv_read_config.h" @@ -70,7 +71,7 @@ CsvReadConfig build_csv_read_config( class IDataChunkSupplier { public: virtual ~IDataChunkSupplier() = default; - virtual std::shared_ptr GetNextChunk() = 0; + virtual std::shared_ptr GetNextChunk() = 0; virtual int64_t RowNum() const = 0; }; @@ -81,7 +82,7 @@ class CSVChunkSupplier : public IDataChunkSupplier { ~CSVChunkSupplier() override; - std::shared_ptr GetNextChunk() override; + std::shared_ptr GetNextChunk() override; int64_t RowNum() const override { return row_num_; } @@ -112,7 +113,7 @@ void fillEdgeReaderMeta(label_t src_label_id, label_t dst_label_id, CsvReadConfig& config); void set_properties_from_context_column( - ColumnBase* col, const std::shared_ptr& ctx_col, + ColumnBase* col, const std::shared_ptr& ctx_col, const std::vector& vids, std::shared_mutex& mutex); } // namespace neug diff --git a/include/neug/transaction/insert_transaction.h b/include/neug/transaction/insert_transaction.h index cb7ac7092..1968406a9 100644 --- a/include/neug/transaction/insert_transaction.h +++ b/include/neug/transaction/insert_transaction.h @@ -23,7 +23,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/graph/graph_interface.h" #include "neug/storages/graph/graph_view.h" @@ -120,8 +120,8 @@ class InsertTransaction { * * @since v0.1.0 */ - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, vid_t& vid); + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid); /** * @brief Add a new edge to the transaction. @@ -148,8 +148,7 @@ class InsertTransaction { * @since v0.1.0 */ Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, - label_t edge_label, - const std::vector& properties, + label_t edge_label, const std::vector& properties, const void*& prop); /** @@ -198,11 +197,10 @@ class InsertTransaction { const Schema& schema() const; - bool GetVertexIndex(label_t label, const execution::Value& oid, - vid_t& lid) const; + bool GetVertexIndex(label_t label, const Value& oid, vid_t& lid) const; private: - execution::Value get_vertex_id(label_t label, vid_t lid) const; + Value get_vertex_id(label_t label, vid_t lid) const; void create_id_indexer_if_not_exists(label_t label); @@ -228,15 +226,13 @@ class StorageTPInsertInterface : public StorageInsertInterface { explicit StorageTPInsertInterface(InsertTransaction& txn) : txn_(txn) {} ~StorageTPInsertInterface() {} - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& vid) override { + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) override { return txn_.AddVertex(label, id, props, vid); } Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, - label_t edge_label, - const std::vector& properties, + label_t edge_label, const std::vector& properties, const void*& prop) override { return txn_.AddEdge(src_label, src, dst_label, dst, edge_label, properties, prop); @@ -244,7 +240,7 @@ class StorageTPInsertInterface : public StorageInsertInterface { inline const Schema& schema() const override { return txn_.schema(); } - bool GetVertexIndex(label_t label, const execution::Value& id, + bool GetVertexIndex(label_t label, const Value& id, vid_t& index) const override { return txn_.GetVertexIndex(label, id, index); } diff --git a/include/neug/transaction/update_transaction.h b/include/neug/transaction/update_transaction.h index 7399e6638..51dfc26f2 100644 --- a/include/neug/transaction/update_transaction.h +++ b/include/neug/transaction/update_transaction.h @@ -24,7 +24,7 @@ #include #include "flat_hash_map/flat_hash_map.hpp" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/execute/query_cache.h" #include "neug/storages/allocators.h" #include "neug/storages/csr/mutable_csr.h" @@ -117,13 +117,11 @@ class UpdateTransaction { // --- Read-only accessors (not graph modifications) --- const Schema& schema() const { return cow_graph_->schema(); } - execution::Value GetVertexId(label_t label, vid_t lid) const; + Value GetVertexId(label_t label, vid_t lid) const; - bool GetVertexIndex(label_t label, const execution::Value& id, - vid_t& index) const; + bool GetVertexIndex(label_t label, const Value& id, vid_t& index) const; - execution::Value GetVertexProperty(label_t label, vid_t lid, - int col_id) const; + Value GetVertexProperty(label_t label, vid_t lid, int col_id) const; std::shared_ptr get_vertex_property_column( uint8_t label, const std::string& col_name) const { @@ -183,17 +181,15 @@ class StorageTPUpdateInterface : public StorageUpdateInterface { // --- DML methods --- Status UpdateVertexProperty(label_t label, vid_t lid, int col_id, - const execution::Value& value) override; + const Value& value) override; Status UpdateEdgeProperty(label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& value) override; - Status AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& vid) override; + const Value& value) override; + Status AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) override; Status AddEdge(label_t src_label, vid_t src, label_t dst_label, vid_t dst, - label_t edge_label, - const std::vector& properties, + label_t edge_label, const std::vector& properties, const void*& prop) override; Status DeleteVertex(label_t label, vid_t lid) override; Status DeleteEdges(label_t src_label, vid_t src, label_t dst_label, vid_t dst, diff --git a/include/neug/transaction/wal/wal.h b/include/neug/transaction/wal/wal.h index 99b2dc7db..802c00ef5 100644 --- a/include/neug/transaction/wal/wal.h +++ b/include/neug/transaction/wal/wal.h @@ -21,7 +21,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/operation_params.h" #include "neug/transaction/transaction_utils.h" #include "neug/utils/property/types.h" @@ -208,80 +208,74 @@ struct DeleteEdgeTypeRedo { struct InsertVertexRedo { label_t label; - execution::Value oid; - std::vector props; + Value oid; + std::vector props; - static void Serialize(InArchive& arc, label_t label, - const execution::Value& oid, - const std::vector& props); + static void Serialize(InArchive& arc, label_t label, const Value& oid, + const std::vector& props); static void Deserialize(OutArchive& arc, InsertVertexRedo& redo); }; struct InsertEdgeRedo { label_t src_label; - execution::Value src; + Value src; label_t dst_label; - execution::Value dst; + Value dst; label_t edge_label; - std::vector properties; + std::vector properties; - static void Serialize(InArchive& arc, label_t src_label, - const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, - const std::vector& properties); + static void Serialize(InArchive& arc, label_t src_label, const Value& src, + label_t dst_label, const Value& dst, label_t edge_label, + const std::vector& properties); static void Deserialize(OutArchive& arc, InsertEdgeRedo& redo); }; struct UpdateVertexPropRedo { label_t label; - execution::Value oid; + Value oid; int prop_id; - execution::Value value; + Value value; - static void Serialize(InArchive& arc, label_t label, - const execution::Value& oid, int prop_id, - const execution::Value& value); + static void Serialize(InArchive& arc, label_t label, const Value& oid, + int prop_id, const Value& value); static void Deserialize(OutArchive& arc, UpdateVertexPropRedo& redo); }; struct UpdateEdgePropRedo { label_t src_label; - execution::Value src; + Value src; label_t dst_label; - execution::Value dst; + Value dst; label_t edge_label; int32_t oe_offset, ie_offset; int prop_id; - execution::Value value; + Value value; - static void Serialize(InArchive& arc, label_t src_label, - const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, + static void Serialize(InArchive& arc, label_t src_label, const Value& src, + label_t dst_label, const Value& dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int prop_id, - const execution::Value& value); + const Value& value); static void Deserialize(OutArchive& arc, UpdateEdgePropRedo& redo); }; struct RemoveVertexRedo { label_t label; - execution::Value oid; + Value oid; - static void Serialize(InArchive& arc, label_t label, - const execution::Value& oid); + static void Serialize(InArchive& arc, label_t label, const Value& oid); static void Deserialize(OutArchive& arc, RemoveVertexRedo& redo); }; struct RemoveEdgeRedo { label_t src_label; - execution::Value src; + Value src; label_t dst_label; - execution::Value dst; + Value dst; label_t edge_label; int32_t oe_offset, ie_offset; - static void Serialize(InArchive& arc, label_t src_label, - const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, + static void Serialize(InArchive& arc, label_t src_label, const Value& src, + label_t dst_label, const Value& dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset); static void Deserialize(OutArchive& arc, RemoveEdgeRedo& redo); }; diff --git a/include/neug/transaction/wal/wal_builder.h b/include/neug/transaction/wal/wal_builder.h index 89c16e7d0..cc0a45e84 100644 --- a/include/neug/transaction/wal/wal_builder.h +++ b/include/neug/transaction/wal/wal_builder.h @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/operation_params.h" #include "neug/transaction/transaction_utils.h" #include "neug/transaction/wal/wal.h" @@ -61,23 +61,21 @@ class WalBuilder { const std::string& edge_type); // --- DML logging --- - void LogInsertVertex(label_t label, const execution::Value& oid, - const std::vector& props); - void LogInsertEdge(label_t src_label, const execution::Value& src, - label_t dst_label, const execution::Value& dst, - label_t edge_label, - const std::vector& properties); - void LogUpdateVertexProp(label_t label, const execution::Value& oid, - int prop_id, const execution::Value& value); - void LogUpdateEdgeProp(label_t src_label, const execution::Value& src, - label_t dst_label, const execution::Value& dst, - label_t edge_label, int32_t oe_offset, - int32_t ie_offset, int prop_id, - const execution::Value& value); - void LogRemoveVertex(label_t label, const execution::Value& oid); - void LogRemoveEdge(label_t src_label, const execution::Value& src, - label_t dst_label, const execution::Value& dst, - label_t edge_label, int32_t oe_offset, int32_t ie_offset); + void LogInsertVertex(label_t label, const Value& oid, + const std::vector& props); + void LogInsertEdge(label_t src_label, const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, + const std::vector& properties); + void LogUpdateVertexProp(label_t label, const Value& oid, int prop_id, + const Value& value); + void LogUpdateEdgeProp(label_t src_label, const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, + int32_t oe_offset, int32_t ie_offset, int prop_id, + const Value& value); + void LogRemoveVertex(label_t label, const Value& oid); + void LogRemoveEdge(label_t src_label, const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, int32_t oe_offset, + int32_t ie_offset); /// Checkpoint: only increments op_num, no WAL content serialized. void LogCheckpoint() { ++op_num_; } diff --git a/include/neug/utils/encoder.h b/include/neug/utils/encoder.h index 179f45619..339f67b9f 100644 --- a/include/neug/utils/encoder.h +++ b/include/neug/utils/encoder.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" namespace neug { diff --git a/include/neug/utils/function_type.h b/include/neug/utils/function_type.h index b5bff46a4..316207ef9 100644 --- a/include/neug/utils/function_type.h +++ b/include/neug/utils/function_type.h @@ -20,9 +20,12 @@ #include #include +#include "neug/common/types/value.h" + namespace neug { namespace execution { -class Value; + +using neug::Value; using neug_func_exec_t = Value (*)(const std::vector&); diff --git a/include/neug/utils/id_indexer.h b/include/neug/utils/id_indexer.h index 20fda3590..0d7112044 100644 --- a/include/neug/utils/id_indexer.h +++ b/include/neug/utils/id_indexer.h @@ -32,7 +32,7 @@ limitations under the License. #include "flat_hash_map/flat_hash_map.hpp" #include "glog/logging.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/container/container_utils.h" #include "neug/storages/container/i_container.h" #include "neug/storages/module/module.h" @@ -168,8 +168,8 @@ struct GHash { }; template <> -struct GHash { - size_t operator()(const execution::Value& val) const { +struct GHash { + size_t operator()(const Value& val) const { if (val.IsNull()) { return 0; } @@ -346,7 +346,7 @@ class LFIndexer { size_t size() const { return num_elements_.load(); } DataTypeId get_type() const { return keys_->type(); } - INDEX_T insert(const execution::Value& oid, bool insert_safe) { + INDEX_T insert(const Value& oid, bool insert_safe) { assert(oid.type().id() == get_type()); if (insert_safe) { @@ -378,7 +378,7 @@ class LFIndexer { return ind; } - INDEX_T get_index(const execution::Value& oid) const { + INDEX_T get_index(const Value& oid) const { assert(oid.type().id() == get_type()); auto* indices_ptr = indices_->data(); size_t index = @@ -396,7 +396,7 @@ class LFIndexer { } } - bool get_index(const execution::Value& oid, INDEX_T& ret) const { + bool get_index(const Value& oid, INDEX_T& ret) const { if (indices_->size() == 0) { return false; } @@ -420,7 +420,7 @@ class LFIndexer { return false; } - bool contains(const execution::Value& oid) const { + bool contains(const Value& oid) const { assert(oid.type().id() == get_type()); auto* indices_ptr = indices_->data(); size_t index = @@ -437,9 +437,7 @@ class LFIndexer { } } - execution::Value get_key(const INDEX_T& index) const { - return keys_->get_any(index); - } + Value get_key(const INDEX_T& index) const { return keys_->get_any(index); } void Close() { keys_.reset(); @@ -459,7 +457,7 @@ class LFIndexer { DataType pk_type_; ska::ska::prime_number_hash_policy hash_policy_; - GHash hasher_; + GHash hasher_; }; template @@ -468,10 +466,10 @@ class IdIndexerBase { IdIndexerBase() = default; virtual ~IdIndexerBase() = default; virtual DataTypeId get_type() const = 0; - virtual void _add(const execution::Value& oid) = 0; - virtual bool add(const execution::Value& oid, INDEX_T& lid) = 0; - virtual bool get_key(const INDEX_T& lid, execution::Value& oid) const = 0; - virtual bool get_index(const execution::Value& oid, INDEX_T& lid) const = 0; + virtual void _add(const Value& oid) = 0; + virtual bool add(const Value& oid, INDEX_T& lid) = 0; + virtual bool get_key(const INDEX_T& lid, Value& oid) const = 0; + virtual bool get_index(const Value& oid, INDEX_T& lid) const = 0; virtual size_t size() const = 0; }; @@ -489,32 +487,32 @@ class IdIndexer : public IdIndexerBase { if constexpr (std::is_same_v) { return DataTypeId::kVarchar; } else { - return execution::ValueConverter::type().id(); + return ValueConverter::type().id(); } } - void _add(const execution::Value& oid) override { + void _add(const Value& oid) override { assert(get_type() == oid.type().id()); KEY_T oid_ = oid.GetValue(); _add(oid_); } - bool add(const execution::Value& oid, INDEX_T& lid) override { + bool add(const Value& oid, INDEX_T& lid) override { assert(get_type() == oid.type().id()); KEY_T oid_ = oid.GetValue(); return add(oid_, lid); } - bool get_key(const INDEX_T& lid, execution::Value& oid) const override { + bool get_key(const INDEX_T& lid, Value& oid) const override { KEY_T oid_; bool flag = get_key(lid, oid_); if (flag) { - oid = execution::Value::CreateValue(oid_); + oid = Value::CreateValue(oid_); } return flag; } - bool get_index(const execution::Value& oid, INDEX_T& lid) const override { + bool get_index(const Value& oid, INDEX_T& lid) const override { assert(get_type() == oid.type().id()); KEY_T oid_ = oid.GetValue(); return get_index(oid_, lid); diff --git a/include/neug/utils/io/read/common/row_expression_filter.h b/include/neug/utils/io/read/common/row_expression_filter.h index 81acad54f..4ac631c05 100644 --- a/include/neug/utils/io/read/common/row_expression_filter.h +++ b/include/neug/utils/io/read/common/row_expression_filter.h @@ -20,7 +20,7 @@ #include #include -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" #include "neug/generated/proto/plan/expr.pb.h" namespace neug { @@ -33,23 +33,21 @@ class RowExpressionFilter { RowExpressionFilter(const ::common::Expression& expr, const std::unordered_map& column_index); - bool eval(const execution::DataChunk& chunk, size_t row) const; + bool eval(const DataChunk& chunk, size_t row) const; private: - std::function evaluator_; + std::function evaluator_; }; -execution::DataChunk filter_chunk( - const execution::DataChunk& input, - const std::shared_ptr<::common::Expression>& filter_expr, - const std::vector& column_names); +DataChunk filter_chunk(const DataChunk& input, + const std::shared_ptr<::common::Expression>& filter_expr, + const std::vector& column_names); -execution::DataChunk project_chunk( - const execution::DataChunk& input, - const std::vector& column_names, - const std::vector& project_columns); +DataChunk project_chunk(const DataChunk& input, + const std::vector& column_names, + const std::vector& project_columns); -execution::DataChunk read_all_chunks( +DataChunk read_all_chunks( const std::vector>& suppliers); } // namespace reader diff --git a/include/neug/utils/pb_utils.h b/include/neug/utils/pb_utils.h index a834b3f45..9a1da2c66 100644 --- a/include/neug/utils/pb_utils.h +++ b/include/neug/utils/pb_utils.h @@ -19,6 +19,7 @@ #include #include +#include "neug/common/types/value.h" #include "neug/generated/proto/plan/basic_type.pb.h" #include "neug/generated/proto/plan/cypher_ddl.pb.h" #include "neug/generated/proto/plan/physical.pb.h" @@ -32,9 +33,6 @@ class Value; } // namespace common namespace neug { -namespace execution { -class Value; -} std::vector parse_result_schema_column_names( const std::string& result_schema); @@ -49,8 +47,7 @@ bool multiplicity_to_storage_strategy( const ::physical::CreateEdgeSchema::Multiplicity& multiplicity, EdgeStrategy& oe_strategy, EdgeStrategy& ie_strategy); -neug::result>> -property_defs_to_value( +neug::result>> property_defs_to_value( const google::protobuf::RepeatedPtrField<::physical::PropertyDef>& properties); diff --git a/include/neug/utils/property/array_column.h b/include/neug/utils/property/array_column.h index 367152440..4ecca9be3 100644 --- a/include/neug/utils/property/array_column.h +++ b/include/neug/utils/property/array_column.h @@ -19,7 +19,7 @@ #include "neug/common/extra_type_info.h" #include "neug/common/types.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/property/column.h" namespace neug { @@ -49,14 +49,13 @@ class ArrayColumn : public ColumnBase { size_t size() const override { return size_; } void resize(size_t size) override; - void resize(size_t size, const execution::Value& default_value) override; + void resize(size_t size, const Value& default_value) override; DataTypeId type() const override { return DataTypeId::kArray; } - void set_any(size_t index, const execution::Value& value, - bool insert_safe) override; + void set_any(size_t index, const Value& value, bool insert_safe) override; - execution::Value get_any(size_t index) const override; + Value get_any(size_t index) const override; void ingest(uint32_t index, OutArchive& arc) override; @@ -87,9 +86,7 @@ class ArrayRefColumn : public RefColumnBase { explicit ArrayRefColumn(const ArrayColumn& column) : column_(column) {} ~ArrayRefColumn() override = default; - execution::Value get_any(size_t index) const override { - return column_.get_any(index); - } + Value get_any(size_t index) const override { return column_.get_any(index); } DataTypeId type() const override { return DataTypeId::kArray; } diff --git a/include/neug/utils/property/column.h b/include/neug/utils/property/column.h index b2c14ea43..439298981 100644 --- a/include/neug/utils/property/column.h +++ b/include/neug/utils/property/column.h @@ -31,8 +31,8 @@ #include #include +#include "neug/common/types/value.h" #include "neug/config.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/checkpoint.h" #include "neug/storages/container/container_utils.h" #include "neug/storages/container/file_header.h" @@ -60,7 +60,7 @@ class ColumnBase : public Module { virtual size_t size() const = 0; virtual void resize(size_t size) = 0; - virtual void resize(size_t size, const execution::Value& default_value) = 0; + virtual void resize(size_t size, const Value& default_value) = 0; virtual DataTypeId type() const = 0; @@ -68,10 +68,9 @@ class ColumnBase : public Module { // new value, which can happen when the value is not fixed length. If the // value is fixed length, we should already have enough space allocated, so // insert_safe can be false. - virtual void set_any(size_t index, const execution::Value& value, - bool insert_safe) = 0; + virtual void set_any(size_t index, const Value& value, bool insert_safe) = 0; - virtual execution::Value get_any(size_t index) const = 0; + virtual Value get_any(size_t index) const = 0; virtual void ingest(uint32_t index, OutArchive& arc) = 0; }; @@ -109,7 +108,7 @@ class TypedColumn : public ColumnBase { // Assume it is safe to insert the default value even if it is reserving, // since user could always override - void resize(size_t size, const execution::Value& default_value) override { + void resize(size_t size, const Value& default_value) override { if (default_value.type().id() != type()) { THROW_RUNTIME_ERROR("Default value type does not match column type"); } @@ -122,9 +121,7 @@ class TypedColumn : public ColumnBase { } } - DataTypeId type() const override { - return execution::ValueConverter::type().id(); - } + DataTypeId type() const override { return ValueConverter::type().id(); } void set_value(size_t index, const T& val) { if (index < size_) { @@ -134,8 +131,7 @@ class TypedColumn : public ColumnBase { } } - void set_any(size_t index, const execution::Value& value, - bool insert_safe) override { + void set_any(size_t index, const Value& value, bool insert_safe) override { if (value.IsNull()) { set_value(index, T()); return; @@ -149,8 +145,8 @@ class TypedColumn : public ColumnBase { return reinterpret_cast(buffer_->GetData())[index]; } - execution::Value get_any(size_t index) const override { - return execution::Value::CreateValue(get_view(index)); + Value get_any(size_t index) const override { + return Value::CreateValue(get_view(index)); } void ingest(uint32_t index, OutArchive& arc) override { @@ -219,18 +215,15 @@ class TypedColumn : public ColumnBase { } size_t size() const override { return 0; } void resize(size_t size) override {} - void resize(size_t size, const execution::Value& default_value) override {} + void resize(size_t size, const Value& default_value) override {} DataTypeId type() const override { return DataTypeId::kEmpty; } - void set_any(size_t index, const execution::Value& value, - bool insert_safe) override {} + void set_any(size_t index, const Value& value, bool insert_safe) override {} void set_value(size_t index, const EmptyType& value) {} - execution::Value get_any(size_t index) const override { - return execution::Value(DataType::EMPTY); - } + Value get_any(size_t index) const override { return Value(DataType::EMPTY); } EmptyType get_view(size_t index) const { return EmptyType(); } @@ -420,7 +413,7 @@ class TypedColumn : public ColumnBase { size_ = size; } - void resize(size_t size, const execution::Value& default_value) override { + void resize(size_t size, const Value& default_value) override { if (default_value.type().id() != type()) { THROW_RUNTIME_ERROR("Default value type does not match column type"); } @@ -473,8 +466,7 @@ class TypedColumn : public ColumnBase { // When insert_safe is set to true, concurrency control should be guaranteed // by caller. - void set_any(size_t idx, const execution::Value& value, - bool insert_safe) override { + void set_any(size_t idx, const Value& value, bool insert_safe) override { if (idx >= size_) { THROW_RUNTIME_ERROR("Index out of range"); } @@ -509,8 +501,8 @@ class TypedColumn : public ColumnBase { return std::string_view(raw_data + item.offset, item.length); } - execution::Value get_any(size_t index) const override { - return execution::Value::STRING(std::string(get_view(index))); + Value get_any(size_t index) const override { + return Value::STRING(std::string(get_view(index))); } void ingest(uint32_t index, OutArchive& arc) override { @@ -595,7 +587,7 @@ class RefColumnBase { kExternal, }; virtual ~RefColumnBase() {} - virtual execution::Value get_any(size_t index) const = 0; + virtual Value get_any(size_t index) const = 0; virtual DataTypeId type() const = 0; virtual ColType col_type() const = 0; }; @@ -616,13 +608,11 @@ class TypedRefColumn : public RefColumnBase { return basic_buffer[index]; } - execution::Value get_any(size_t index) const override { - return execution::Value::CreateValue(get_view(index)); + Value get_any(size_t index) const override { + return Value::CreateValue(get_view(index)); } - DataTypeId type() const override { - return execution::ValueConverter::type().id(); - } + DataTypeId type() const override { return ValueConverter::type().id(); } ColType col_type() const override { return ColType::kInternal; } @@ -645,8 +635,8 @@ class TypedRefColumn : public RefColumnBase { return column_.get_view(index); } - execution::Value get_any(size_t index) const override { - return execution::Value::STRING(std::string(get_view(index))); + Value get_any(size_t index) const override { + return Value::STRING(std::string(get_view(index))); } DataTypeId type() const override { return DataTypeId::kVarchar; } diff --git a/include/neug/utils/property/default_value.h b/include/neug/utils/property/default_value.h index 481469e3a..7a78fe183 100644 --- a/include/neug/utils/property/default_value.h +++ b/include/neug/utils/property/default_value.h @@ -14,12 +14,10 @@ */ #pragma once #include "neug/common/types.h" -namespace neug { +#include "neug/common/types/value.h" -namespace execution { -class Value; -} // namespace execution +namespace neug { -execution::Value get_default_value(const DataType& type); +Value get_default_value(const DataType& type); } // namespace neug diff --git a/include/neug/utils/property/table.h b/include/neug/utils/property/table.h index 717a91f9f..fa8bcd086 100644 --- a/include/neug/utils/property/table.h +++ b/include/neug/utils/property/table.h @@ -21,8 +21,8 @@ #include #include +#include "neug/common/types/value.h" #include "neug/config.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/checkpoint.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/module/module.h" @@ -62,7 +62,7 @@ class Table { void add_columns(Checkpoint& ckp, const std::vector& col_names, const std::vector& col_types, - const std::vector& default_property_values, + const std::vector& default_property_values, size_t capacity, MemoryLevel memory_level = MemoryLevel::kInMemory); @@ -78,7 +78,7 @@ class Table { const ColumnBase* get_column(const std::string& name) const; - std::vector get_row(size_t row_id) const; + std::vector get_row(size_t row_id) const; ColumnBase* get_column_by_id(size_t index); @@ -97,8 +97,7 @@ class Table { } } - void insert(size_t index, const std::vector& values, - bool insert_safe); + void insert(size_t index, const std::vector& values, bool insert_safe); void resize(size_t row_num); /** @@ -106,8 +105,7 @@ class Table { * values. Assume it is safe to insert the default value even if it is * reserving, since user could always override. */ - void resize(size_t row_num, - const std::vector& default_values); + void resize(size_t row_num, const std::vector& default_values); void ingest(uint32_t index, OutArchive& arc); diff --git a/include/neug/utils/top_n_generator.h b/include/neug/utils/top_n_generator.h index 646e6e8f2..27fcfc2a4 100644 --- a/include/neug/utils/top_n_generator.h +++ b/include/neug/utils/top_n_generator.h @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" namespace neug { diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 4efe47bc2..f71ee8c01 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,5 +1,8 @@ -file(GLOB_RECURSE EXECUTION_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") -add_library(neug_common OBJECT ${EXECUTION_SRC_FILES}) +file(GLOB_RECURSE COMMON_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/*.cc" + "${CMAKE_CURRENT_SOURCE_DIR}/types/*.cc" + "${CMAKE_CURRENT_SOURCE_DIR}/columns/*.cc") +add_library(neug_common OBJECT ${COMMON_SRC_FILES}) add_dependencies(neug_common neug_proto) set(ALL_OBJECT_FILES diff --git a/src/execution/common/columns/array_columns.cc b/src/common/columns/array_columns.cc similarity index 86% rename from src/execution/common/columns/array_columns.cc rename to src/common/columns/array_columns.cc index a27fa838d..da9afe0f5 100644 --- a/src/execution/common/columns/array_columns.cc +++ b/src/common/columns/array_columns.cc @@ -9,16 +9,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * See the License for permissions and limitations under the License. */ -#include "neug/execution/common/columns/array_columns.h" +#include "neug/common/types/array_columns.h" #include namespace neug { -namespace execution { std::pair, sel_vec_t> ArrayColumn::unfold() const { @@ -52,5 +50,4 @@ std::shared_ptr ArrayColumn::shuffle( return result; } -} // namespace execution } // namespace neug diff --git a/src/execution/common/columns/columns_utils.cc b/src/common/columns/columns_utils.cc similarity index 79% rename from src/execution/common/columns/columns_utils.cc rename to src/common/columns/columns_utils.cc index 4e77545e9..b7458075b 100644 --- a/src/execution/common/columns/columns_utils.cc +++ b/src/common/columns/columns_utils.cc @@ -13,18 +13,17 @@ * limitations under the License. */ -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/columns/array_columns.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/list_columns.h" -#include "neug/execution/common/columns/path_columns.h" -#include "neug/execution/common/columns/struct_columns.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/columns/path_columns.h" +#include "neug/common/columns/struct_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/array_columns.h" #include "neug/utils/exception/exception.h" namespace neug { -namespace execution { std::shared_ptr ColumnsUtils::create_builder( const DataType& type) { switch (type.id()) { @@ -62,5 +61,4 @@ std::shared_ptr ColumnsUtils::create_builder( return nullptr; } } -} // namespace execution } // namespace neug diff --git a/src/execution/common/columns/edge_columns.cc b/src/common/columns/edge_columns.cc similarity index 99% rename from src/execution/common/columns/edge_columns.cc rename to src/common/columns/edge_columns.cc index 4adc7cebb..5ba8ad967 100644 --- a/src/execution/common/columns/edge_columns.cc +++ b/src/common/columns/edge_columns.cc @@ -13,12 +13,10 @@ * limitations under the License. */ -#include "neug/execution/common/columns/edge_columns.h" +#include "neug/common/columns/edge_columns.h" namespace neug { -namespace execution { - std::shared_ptr SDSLEdgeColumn::shuffle( const sel_vec_t& offsets) const { SDSLEdgeColumnBuilder builder(dir_, label_); @@ -351,6 +349,4 @@ std::shared_ptr BDMLEdgeColumn::optional_shuffle( return builder.finish(); } -} // namespace execution - } // namespace neug diff --git a/src/execution/common/columns/list_columns.cc b/src/common/columns/list_columns.cc similarity index 91% rename from src/execution/common/columns/list_columns.cc rename to src/common/columns/list_columns.cc index 0f13668f0..6d80eb784 100644 --- a/src/execution/common/columns/list_columns.cc +++ b/src/common/columns/list_columns.cc @@ -13,15 +13,14 @@ * limitations under the License. */ -#include "neug/execution/common/columns/list_columns.h" -#include "neug/execution/common/columns/array_columns.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/struct_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/struct_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/array_columns.h" #include "neug/utils/exception/exception.h" namespace neug { -namespace execution { std::pair, sel_vec_t> ListColumn::unfold() const { @@ -123,5 +122,4 @@ std::shared_ptr ListColumn::shuffle( return ptr; } -} // namespace execution } // namespace neug \ No newline at end of file diff --git a/src/execution/common/columns/path_columns.cc b/src/common/columns/path_columns.cc similarity index 94% rename from src/execution/common/columns/path_columns.cc rename to src/common/columns/path_columns.cc index 36a9f1198..4948d7855 100644 --- a/src/execution/common/columns/path_columns.cc +++ b/src/common/columns/path_columns.cc @@ -13,12 +13,11 @@ * limitations under the License. */ -#include "neug/execution/common/columns/path_columns.h" +#include "neug/common/columns/path_columns.h" #include namespace neug { -namespace execution { std::shared_ptr PathColumn::shuffle( const sel_vec_t& offsets) const { @@ -59,5 +58,4 @@ std::shared_ptr PathColumn::optional_shuffle( return builder.finish(); } -} // namespace execution } // namespace neug diff --git a/src/execution/common/columns/struct_columns.cc b/src/common/columns/struct_columns.cc similarity index 95% rename from src/execution/common/columns/struct_columns.cc rename to src/common/columns/struct_columns.cc index 5b8d8d0ad..4999809fa 100644 --- a/src/execution/common/columns/struct_columns.cc +++ b/src/common/columns/struct_columns.cc @@ -13,11 +13,10 @@ * limitations under the License. */ -#include "neug/execution/common/columns/struct_columns.h" -#include "neug/execution/common/columns/columns_utils.h" +#include "neug/common/columns/struct_columns.h" +#include "neug/common/columns/columns_utils.h" namespace neug { -namespace execution { std::shared_ptr StructColumn::shuffle( const sel_vec_t& offsets) const { std::vector> shuffled_children; @@ -114,5 +113,4 @@ std::shared_ptr StructColumnBuilder::finish() { return struct_col; } -} // namespace execution } // namespace neug \ No newline at end of file diff --git a/src/execution/common/columns/vertex_columns.cc b/src/common/columns/vertex_columns.cc similarity index 98% rename from src/execution/common/columns/vertex_columns.cc rename to src/common/columns/vertex_columns.cc index f42135633..0a83fa473 100644 --- a/src/execution/common/columns/vertex_columns.cc +++ b/src/common/columns/vertex_columns.cc @@ -13,10 +13,9 @@ * limitations under the License. */ -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" namespace neug { -namespace execution { std::shared_ptr SLVertexColumn::shuffle( const sel_vec_t& offsets) const { @@ -297,6 +296,4 @@ std::shared_ptr MLVertexColumnBuilder::finish() { return ret; } -} // namespace execution - } // namespace neug diff --git a/src/execution/common/data_chunk.cc b/src/common/types/data_chunk.cc similarity index 97% rename from src/execution/common/data_chunk.cc rename to src/common/types/data_chunk.cc index 2b3505eaf..c3513999b 100644 --- a/src/execution/common/data_chunk.cc +++ b/src/common/types/data_chunk.cc @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "neug/execution/common/data_chunk.h" +#include "neug/common/types/data_chunk.h" #include @@ -23,8 +23,6 @@ namespace neug { -namespace execution { - void DataChunk::clear() { columns.clear(); } void DataChunk::set(int alias, std::shared_ptr col) { @@ -131,6 +129,4 @@ DataChunk DataChunk::union_chunk(const DataChunk& other) const { return out; } -} // namespace execution - } // namespace neug diff --git a/src/execution/common/types/graph_types.cc b/src/common/types/graph_types.cc similarity index 98% rename from src/execution/common/types/graph_types.cc rename to src/common/types/graph_types.cc index cc92a431e..d9b7d7e6e 100644 --- a/src/execution/common/types/graph_types.cc +++ b/src/common/types/graph_types.cc @@ -14,12 +14,11 @@ * limitations under the License. */ -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/types/graph_types.h" #include "neug/utils/property/types.h" namespace neug { -namespace execution { int64_t encode_unique_vertex_id(label_t label_id, vid_t vid) { // encode label_id and vid to a unique vid GlobalId global_id(label_id, vid); @@ -248,5 +247,4 @@ VertexRecord Path::end_node() const { return VertexRecord{impl_->v_label_, impl_->vid_}; } -} // namespace execution } // namespace neug diff --git a/src/execution/common/types/value.cc b/src/common/types/value.cc similarity index 90% rename from src/execution/common/types/value.cc rename to src/common/types/value.cc index 905600800..fde34f9b2 100644 --- a/src/execution/common/types/value.cc +++ b/src/common/types/value.cc @@ -19,14 +19,13 @@ * by Liu Lexiao in 2026 to support Neug-specific features. */ -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/encoder.h" #include "neug/utils/exception/exception.h" #include "neug/utils/serialization/in_archive.h" #include "neug/utils/serialization/out_archive.h" namespace neug { -namespace execution { enum class ExtraValueInfoType : uint8_t { INVALID_TYPE_INFO = 0, STRING_VALUE_INFO = 1, @@ -706,67 +705,65 @@ Value Value::FromJson(const rapidjson::Value& json_value, case DataTypeId::kBoolean: { // If the value is 1/0, treat it as boolean if (json_value.IsInt()) { - return execution::Value::BOOLEAN(json_value.GetInt() != 0); + return Value::BOOLEAN(json_value.GetInt() != 0); } - return execution::Value::BOOLEAN(json_value.GetBool()); + return Value::BOOLEAN(json_value.GetBool()); } case DataTypeId::kDate: { if (json_value.IsInt64()) { - return execution::Value::DATE(Date(json_value.GetInt64())); + return Value::DATE(Date(json_value.GetInt64())); } else if (json_value.IsString()) { - return execution::Value::DATE(Date(json_value.GetString())); + return Value::DATE(Date(json_value.GetString())); } else { THROW_INVALID_ARGUMENT_EXCEPTION( "Expected an (u)int/string for Date type"); } } case DataTypeId::kDouble: { - return execution::Value::DOUBLE(json_value.GetDouble()); + return Value::DOUBLE(json_value.GetDouble()); } case DataTypeId::kFloat: { - return execution::Value::FLOAT(json_value.GetFloat()); + return Value::FLOAT(json_value.GetFloat()); } case DataTypeId::kInt32: { - return execution::Value::INT32(json_value.GetInt()); + return Value::INT32(json_value.GetInt()); } case DataTypeId::kInt64: { - return execution::Value::INT64(json_value.GetInt64()); + return Value::INT64(json_value.GetInt64()); } case DataTypeId::kUInt32: { - return execution::Value::UINT32(json_value.GetUint()); + return Value::UINT32(json_value.GetUint()); } case DataTypeId::kUInt64: { - return execution::Value::UINT64(json_value.GetUint64()); + return Value::UINT64(json_value.GetUint64()); } case DataTypeId::kVarchar: { - return execution::Value::STRING(json_value.GetString()); + return Value::STRING(json_value.GetString()); } case DataTypeId::kTimestampMs: { if (json_value.IsInt64()) { - return execution::Value::TIMESTAMPMS( - execution::timestamp_ms_t(json_value.GetInt64())); + return Value::TIMESTAMPMS(timestamp_ms_t(json_value.GetInt64())); } else if (json_value.IsString()) { - return execution::Value::TIMESTAMPMS( - execution::timestamp_ms_t(json_value.GetString())); + return Value::TIMESTAMPMS(timestamp_ms_t(json_value.GetString())); } else { THROW_INVALID_ARGUMENT_EXCEPTION( "Expected an (u)int64/string for TimestampMs type"); } } case DataTypeId::kList: { - std::vector values; + std::vector values; if (!json_value.IsArray()) { - return execution::Value::LIST(DataType::UNKNOWN, std::move(values)); + return Value::LIST(DataType::UNKNOWN, std::move(values)); } const auto list = json_value.GetArray(); auto child_type = ListType::GetChildType(type); for (auto item = list.begin(); item != list.end(); ++item) { values.emplace_back(FromJson(*item, child_type)); } - return execution::Value::LIST(child_type, std::move(values)); + return Value::LIST(child_type, std::move(values)); } case DataTypeId::kArray: { - std::vector values; + std::vector values; if (!json_value.IsArray()) { THROW_INVALID_ARGUMENT_EXCEPTION("Expected an array for ARRAY type"); } @@ -782,7 +779,7 @@ Value Value::FromJson(const rapidjson::Value& json_value, for (auto item = arr.begin(); item != arr.end(); ++item) { values.emplace_back(FromJson(*item, child_type)); } - return execution::Value::ARRAY(type, std::move(values)); + return Value::ARRAY(type, std::move(values)); } default: THROW_NOT_IMPLEMENTED_EXCEPTION( @@ -808,37 +805,37 @@ rapidjson::Value Value::ToJson(const Value& value, } auto type_id = value.type().id(); switch (type_id) { - case neug::DataTypeId::kVarchar: { + case DataTypeId::kVarchar: { return rapidjson::Value(value.GetValue().c_str(), allocator); } #define TYPE_DISPATCHER(type_enum, cpp_type) \ - case neug::DataTypeId::type_enum: { \ + case DataTypeId::type_enum: { \ return rapidjson::Value( \ static_cast(value.GetValue())); \ } FOR_EACH_NUMERIC_DATA_TYPE(TYPE_DISPATCHER) #undef TYPE_DISPATCHER - case neug::DataTypeId::kList: { + case DataTypeId::kList: { rapidjson::Value list_doc(rapidjson::kArrayType); - const auto& list = execution::ListValue::GetChildren(value); + const auto& list = ListValue::GetChildren(value); for (size_t i = 0; i < list.size(); ++i) { list_doc.PushBack(ToJson(list[i], allocator), allocator); } return list_doc; } - case neug::DataTypeId::kArray: { + case DataTypeId::kArray: { rapidjson::Value array_doc(rapidjson::kArrayType); - const auto& elements = execution::ArrayValue::GetChildren(value); + const auto& elements = ArrayValue::GetChildren(value); for (size_t i = 0; i < elements.size(); ++i) { array_doc.PushBack(ToJson(elements[i], allocator), allocator); } return array_doc; } - case neug::DataTypeId::kDate: { + case DataTypeId::kDate: { return rapidjson::Value(value.GetValue().to_string().c_str(), allocator); } - case neug::DataTypeId::kTimestampMs: { + case DataTypeId::kTimestampMs: { return rapidjson::Value( value.GetValue().to_string().c_str(), allocator); } @@ -959,9 +956,7 @@ Value performCastToString(const Value& input) { return Value::STRING(ret); } -} // namespace execution - -InArchive& operator<<(InArchive& in_archive, const execution::Value& value) { +InArchive& operator<<(InArchive& in_archive, const Value& value) { auto type_id = value.type().id(); if (value.IsNull()) { in_archive << DataTypeId::kEmpty; @@ -980,21 +975,20 @@ InArchive& operator<<(InArchive& in_archive, const execution::Value& value) { } else if (type_id == DataTypeId::kDouble) { in_archive << type_id << value.GetValue(); } else if (type_id == DataTypeId::kVarchar) { - in_archive << type_id << execution::StringValue::Get(value); + in_archive << type_id << StringValue::Get(value); } else if (type_id == DataTypeId::kDate) { - in_archive << type_id << value.GetValue().to_u32(); + in_archive << type_id << value.GetValue().to_u32(); } else if (type_id == DataTypeId::kTimestampMs) { - in_archive << type_id - << value.GetValue().milli_second; + in_archive << type_id << value.GetValue().milli_second; } else if (type_id == DataTypeId::kInterval) { - auto interval = value.GetValue(); + auto interval = value.GetValue(); in_archive << type_id << interval.months << interval.days << interval.micros; } else if (type_id == DataTypeId::kList || type_id == DataTypeId::kArray) { in_archive << type_id << value.type(); const auto& children = (type_id == DataTypeId::kList) - ? execution::ListValue::GetChildren(value) - : execution::ArrayValue::GetChildren(value); + ? ListValue::GetChildren(value) + : ArrayValue::GetChildren(value); in_archive << static_cast(children.size()); for (const auto& child : children) { in_archive << child; @@ -1007,74 +1001,73 @@ InArchive& operator<<(InArchive& in_archive, const execution::Value& value) { return in_archive; } -OutArchive& operator>>(OutArchive& out_archive, execution::Value& value) { +OutArchive& operator>>(OutArchive& out_archive, Value& value) { DataTypeId type_id; out_archive >> type_id; if (type_id == DataTypeId::kEmpty) { - value = execution::Value(); + value = Value(); } else if (type_id == DataTypeId::kBoolean) { bool tmp; out_archive >> tmp; - value = execution::Value::BOOLEAN(tmp); + value = Value::BOOLEAN(tmp); } else if (type_id == DataTypeId::kInt32) { int32_t tmp; out_archive >> tmp; - value = execution::Value::INT32(tmp); + value = Value::INT32(tmp); } else if (type_id == DataTypeId::kUInt32) { uint32_t tmp; out_archive >> tmp; - value = execution::Value::UINT32(tmp); + value = Value::UINT32(tmp); } else if (type_id == DataTypeId::kInt64) { int64_t tmp; out_archive >> tmp; - value = execution::Value::INT64(tmp); + value = Value::INT64(tmp); } else if (type_id == DataTypeId::kUInt64) { uint64_t tmp; out_archive >> tmp; - value = execution::Value::UINT64(tmp); + value = Value::UINT64(tmp); } else if (type_id == DataTypeId::kFloat) { float tmp; out_archive >> tmp; - value = execution::Value::FLOAT(tmp); + value = Value::FLOAT(tmp); } else if (type_id == DataTypeId::kDouble) { double tmp; out_archive >> tmp; - value = execution::Value::DOUBLE(tmp); + value = Value::DOUBLE(tmp); } else if (type_id == DataTypeId::kVarchar) { std::string_view tmp; out_archive >> tmp; - value = execution::Value::STRING(std::string(tmp)); + value = Value::STRING(std::string(tmp)); } else if (type_id == DataTypeId::kDate) { uint32_t date_val; out_archive >> date_val; Date d; d.from_u32(date_val); - value = execution::Value::DATE(d); + value = Value::DATE(d); } else if (type_id == DataTypeId::kTimestampMs) { int64_t dt_val; out_archive >> dt_val; - value = execution::Value::TIMESTAMPMS(DateTime(dt_val)); + value = Value::TIMESTAMPMS(DateTime(dt_val)); } else if (type_id == DataTypeId::kInterval) { Interval interval; out_archive >> interval.months >> interval.days >> interval.micros; - value = execution::Value::INTERVAL(interval); + value = Value::INTERVAL(interval); } else if (type_id == DataTypeId::kList || type_id == DataTypeId::kArray) { DataType dt; out_archive >> dt; uint32_t num_children; out_archive >> num_children; - std::vector children; + std::vector children; children.reserve(num_children); for (uint32_t i = 0; i < num_children; ++i) { - execution::Value child; + Value child; out_archive >> child; children.push_back(std::move(child)); } if (type_id == DataTypeId::kList) { - value = execution::Value::LIST(ListType::GetChildType(dt), - std::move(children)); + value = Value::LIST(ListType::GetChildType(dt), std::move(children)); } else { - value = execution::Value::ARRAY(dt, std::move(children)); + value = Value::ARRAY(dt, std::move(children)); } } else { THROW_NOT_SUPPORTED_EXCEPTION( diff --git a/src/compiler/binder/bind/bind_ddl.cpp b/src/compiler/binder/bind/bind_ddl.cpp index 7cf8111e0..5d39168cc 100644 --- a/src/compiler/binder/bind/bind_ddl.cpp +++ b/src/compiler/binder/bind/bind_ddl.cpp @@ -100,7 +100,7 @@ std::unique_ptr Binder::resolvePropertyDefault( if (parsedDefault == nullptr) { // No default provided. // set system default value if query default value is not set return std::make_unique( - Value::createDefaultValue(type), "NULL"); + compiler_impl::Value::createDefaultValue(type), "NULL"); } else { return parsedDefault->copy(); } @@ -225,7 +225,7 @@ void Binder::validateColumnExistence(const TableCatalogEntry* entry, } static ExtendDirection getStorageDirection( - const case_insensitive_map_t& options) { + const case_insensitive_map_t& options) { if (options.contains(TableOptionConstants::REL_STORAGE_DIRECTION_OPTION)) { return ExtendDirectionUtil::fromString( options.at(TableOptionConstants::REL_STORAGE_DIRECTION_OPTION) diff --git a/src/compiler/binder/bind/bind_file_scan.cpp b/src/compiler/binder/bind/bind_file_scan.cpp index 708e7a36f..25741d6cf 100644 --- a/src/compiler/binder/bind/bind_file_scan.cpp +++ b/src/compiler/binder/bind/bind_file_scan.cpp @@ -88,9 +88,9 @@ std::vector Binder::bindFilePaths( return filePaths; } -case_insensitive_map_t Binder::bindParsingOptions( +case_insensitive_map_t Binder::bindParsingOptions( const options_t& parsingOptions) { - case_insensitive_map_t options; + case_insensitive_map_t options; for (auto& option : parsingOptions) { auto name = option.first; StringUtils::toUpper(name); @@ -169,7 +169,7 @@ std::unique_ptr Binder::bindFileScanSource( // Bind table function auto bindInput = TableFuncBindInput(); - bindInput.addLiteralParam(Value::createValue(filePaths[0])); + bindInput.addLiteralParam(compiler_impl::Value::createValue(filePaths[0])); auto extraInput = std::make_unique(); extraInput->fileScanInfo = fileScanInfo->copy(); auto& expectedColumnNames = extraInput->expectedColumnNames; diff --git a/src/compiler/binder/bind/bind_table_function.cpp b/src/compiler/binder/bind/bind_table_function.cpp index 0331f7270..95950d7a4 100644 --- a/src/compiler/binder/bind/bind_table_function.cpp +++ b/src/compiler/binder/bind/bind_table_function.cpp @@ -111,10 +111,10 @@ BoundTableScanInfo Binder::bindTableFunc( positionalParams[i] = expressionBinder.implicitCastIfNecessary( positionalParams[i], inputTypes[i]); // A bare LITERAL already holds its final value — fold would only - // re-materialize it through a ValueVector. We skip that round-trip - // because the literal-fold path currently trips NEUG_UNREACHABLE in - // DataType::getPhysicalType (types.cpp:990) for at least - // JSON_SCAN's STRING parameter. When the cast above wrapped the + // re-materialize it through a common::ValueVector. We skip that + // round-trip because the literal-fold path currently trips + // NEUG_UNREACHABLE in DataType::getPhysicalType (types.cpp:990) for at + // least JSON_SCAN's STRING parameter. When the cast above wrapped the // literal in a CAST function expression we still need to fold to // evaluate the cast. if (positionalParams[i]->expressionType != ExpressionType::LITERAL) { diff --git a/src/compiler/binder/bind/copy/bind_copy_from.cpp b/src/compiler/binder/bind/copy/bind_copy_from.cpp index 0ba7eb858..6f2bd6eab 100644 --- a/src/compiler/binder/bind/copy/bind_copy_from.cpp +++ b/src/compiler/binder/bind/copy/bind_copy_from.cpp @@ -67,7 +67,7 @@ DDLVertexInfo::DDLVertexInfo(const std::string& vertexLabelName, primaryKeyFound = true; } auto defaultExpr = std::make_unique( - Value::createDefaultValue(col->getDataType()), "NULL"); + compiler_impl::Value::createDefaultValue(col->getDataType()), "NULL"); auto boundExpr = binder.bindExpression(*defaultExpr); nodeTableEntry->addProperty( PropertyDefinition(ColumnDefinition(colName, col->getDataType().copy()), @@ -121,7 +121,8 @@ DDLEdgeInfo::DDLEdgeInfo(const std::string& edgeLabelName, const auto& column = columns[i]; const auto& colName = column->rawName(); auto defaultExpr = std::make_unique( - Value::createDefaultValue(column->getDataType()), "NULL"); + compiler_impl::Value::createDefaultValue(column->getDataType()), + "NULL"); auto boundExpr = binder.bindExpression(*defaultExpr); relProps.emplace_back( ColumnDefinition(colName, column->getDataType().copy()), @@ -182,7 +183,7 @@ BoundCopyFromInfo::BoundCopyFromInfo( // boundCopyOptions: keys are upper-case (see bindParsingOptions). static bool autoDetectEnabled( - const case_insensitive_map_t& boundCopyOptions) { + const case_insensitive_map_t& boundCopyOptions) { auto it = boundCopyOptions.find("AUTO_DETECT"); if (it != boundCopyOptions.end()) { return it->second.getValue(); @@ -388,7 +389,8 @@ std::unique_ptr Binder::bindCopyRelFrom( std::unique_ptr Binder::bindCopyNodeFromNoSchema( const Statement& statement, - const case_insensitive_map_t& boundCopyOptions, bool temporary) { + const case_insensitive_map_t& boundCopyOptions, + bool temporary) { (void) boundCopyOptions; auto& copyStatement = neug_dynamic_cast(statement); auto boundSource = bindScanSource(copyStatement.getSource(), @@ -415,7 +417,8 @@ std::unique_ptr Binder::bindCopyNodeFromNoSchema( std::unique_ptr Binder::bindCopyRelFromNoSchema( const Statement& statement, - const case_insensitive_map_t& boundCopyOptions, bool temporary) { + const case_insensitive_map_t& boundCopyOptions, + bool temporary) { auto& copyStatement = statement.constCast(); if (copyStatement.byColumn()) { THROW_BINDER_EXCEPTION(stringFormat( diff --git a/src/compiler/binder/bind_expression/bind_literal_expression.cpp b/src/compiler/binder/bind_expression/bind_literal_expression.cpp index 71eae8779..85d9d3b7f 100644 --- a/src/compiler/binder/bind_expression/bind_literal_expression.cpp +++ b/src/compiler/binder/bind_expression/bind_literal_expression.cpp @@ -43,24 +43,25 @@ std::shared_ptr ExpressionBinder::bindLiteralExpression( } std::shared_ptr ExpressionBinder::createLiteralExpression( - const Value& value) const { + const compiler_impl::Value& value) const { auto uniqueName = binder->getUniqueExpressionName(value.toString()); return std::make_unique(value, uniqueName); } std::shared_ptr ExpressionBinder::createLiteralExpression( const std::string& strVal) const { - return createLiteralExpression(Value(strVal)); + return createLiteralExpression(compiler_impl::Value(strVal)); } std::shared_ptr ExpressionBinder::createNullLiteralExpression() const { return make_shared( - Value::createNullValue(), binder->getUniqueExpressionName("NULL")); + compiler_impl::Value::createNullValue(), + binder->getUniqueExpressionName("NULL")); } std::shared_ptr ExpressionBinder::createNullLiteralExpression( - const Value& value) const { + const compiler_impl::Value& value) const { return make_shared( value, binder->getUniqueExpressionName("NULL")); } diff --git a/src/compiler/binder/bind_expression/bind_parameter_expression.cpp b/src/compiler/binder/bind_expression/bind_parameter_expression.cpp index 5ae13ae67..fb71979e7 100644 --- a/src/compiler/binder/bind_expression/bind_parameter_expression.cpp +++ b/src/compiler/binder/bind_expression/bind_parameter_expression.cpp @@ -39,7 +39,8 @@ std::shared_ptr ExpressionBinder::bindParameterExpression( return make_shared(parameterName, *parameterMap.at(parameterName)); } else { - auto value = std::make_shared(Value::createNullValue()); + auto value = std::make_shared( + compiler_impl::Value::createNullValue()); parameterMap.insert({parameterName, value}); return std::make_shared(parameterName, *value); } diff --git a/src/compiler/binder/bind_expression/bind_subquery_expression.cpp b/src/compiler/binder/bind_expression/bind_subquery_expression.cpp index 221f3529f..289128078 100644 --- a/src/compiler/binder/bind_expression/bind_subquery_expression.cpp +++ b/src/compiler/binder/bind_expression/bind_subquery_expression.cpp @@ -81,7 +81,8 @@ std::shared_ptr ExpressionBinder::bindSubqueryExpression( } break; case SubqueryType::EXISTS: { // Rewrite EXISTS subquery as COUNT(*) > 0 - auto literalExpr = createLiteralExpression(Value(static_cast(0))); + auto literalExpr = + createLiteralExpression(compiler_impl::Value(static_cast(0))); projectionExpr = bindComparisonExpression(ExpressionType::GREATER_THAN, expression_vector{countStarExpr, literalExpr}); diff --git a/src/compiler/binder/bound_statement_result.cpp b/src/compiler/binder/bound_statement_result.cpp index 6eeff5bd4..7bbf08169 100644 --- a/src/compiler/binder/bound_statement_result.cpp +++ b/src/compiler/binder/bound_statement_result.cpp @@ -32,7 +32,7 @@ namespace binder { BoundStatementResult BoundStatementResult::createSingleStringColumnResult( const std::string& columnName) { auto result = BoundStatementResult(); - auto value = Value(DataType::Varchar(), columnName); + auto value = compiler_impl::Value(DataType::Varchar(), columnName); auto stringColumn = std::make_shared(std::move(value), columnName); result.addColumn(columnName, stringColumn); diff --git a/src/compiler/binder/ddl/property_definition.cpp b/src/compiler/binder/ddl/property_definition.cpp index 7573f14d6..f9d3d835d 100644 --- a/src/compiler/binder/ddl/property_definition.cpp +++ b/src/compiler/binder/ddl/property_definition.cpp @@ -35,7 +35,7 @@ namespace binder { PropertyDefinition::PropertyDefinition(ColumnDefinition columnDefinition) : columnDefinition{std::move(columnDefinition)} { defaultExpr = std::make_unique( - Value::createNullValue(), "NULL"); + compiler_impl::Value::createNullValue(), "NULL"); } void PropertyDefinition::serialize(Serializer& serializer) const { diff --git a/src/compiler/binder/expression/expression_util.cpp b/src/compiler/binder/expression/expression_util.cpp index 675f1ce0a..4026f026f 100644 --- a/src/compiler/binder/expression/expression_util.cpp +++ b/src/compiler/binder/expression/expression_util.cpp @@ -210,7 +210,7 @@ bool ExpressionUtil::isFalseLiteral(const Expression& expression) { } bool ExpressionUtil::isEmptyList(const Expression& expression) { - auto val = Value::createNullValue(); + auto val = compiler_impl::Value::createNullValue(); switch (expression.expressionType) { case ExpressionType::LITERAL: { val = expression.constCast().getValue(); @@ -373,7 +373,8 @@ static bool compatible(const DataType& type, const DataType& target) { // Handle special cases where value can be compatible to a type. This happens // when a value is a nested value but does not have any child. E.g. [] is // compatible with [1,2] -static bool compatible(const Value& value, const DataType& targetType) { +static bool compatible(const compiler_impl::Value& value, + const DataType& targetType) { if (value.isNull()) { // Value is null. We can safely change its type. return true; } @@ -434,7 +435,7 @@ static bool compatible(const Value& value, const DataType& targetType) { bool ExpressionUtil::tryCombineDataType(const expression_vector& expressions, DataType& result) { - std::vector secondaryValues; + std::vector secondaryValues; std::vector primaryTypes; bool propKeyValues = false; if (expressions.size() == 2 && @@ -503,9 +504,10 @@ bool ExpressionUtil::canEvaluateAsLiteral(const Expression& expr) { expr.getDataType().id() != DataTypeId::kUnknown)); } -Value ExpressionUtil::evaluateAsLiteralValue(const Expression& expr) { +compiler_impl::Value ExpressionUtil::evaluateAsLiteralValue( + const Expression& expr) { NEUG_ASSERT(canEvaluateAsLiteral(expr)); - auto value = Value::createDefaultValue(expr.dataType); + auto value = compiler_impl::Value::createDefaultValue(expr.dataType); switch (expr.expressionType) { case ExpressionType::LITERAL: { value = expr.constCast().getValue(); diff --git a/src/compiler/binder/expression_binder.cpp b/src/compiler/binder/expression_binder.cpp index c02ec3114..2931b1187 100644 --- a/src/compiler/binder/expression_binder.cpp +++ b/src/compiler/binder/expression_binder.cpp @@ -55,7 +55,8 @@ std::shared_ptr ExpressionBinder::bindExpression( auto name = parsedExpr->constCast().getParameterName(); if (!parameterMap.contains(name)) { - auto value = std::make_shared(Value::createNullValue()); + auto value = std::make_shared( + compiler_impl::Value::createNullValue()); parameterMap.insert({name, value}); allParamExist = false; } @@ -162,7 +163,8 @@ std::shared_ptr ExpressionBinder::forceCast( return expression; } auto children = expression_vector{ - expression, createLiteralExpression(Value(targetType.ToString()))}; + expression, + createLiteralExpression(compiler_impl::Value(targetType.ToString()))}; return bindScalarFunctionExpression(children, functionName); } diff --git a/src/compiler/binder/expression_evaluator_utils.cpp b/src/compiler/binder/expression_evaluator_utils.cpp index 6d779ed51..7dadcd73f 100644 --- a/src/compiler/binder/expression_evaluator_utils.cpp +++ b/src/compiler/binder/expression_evaluator_utils.cpp @@ -31,7 +31,7 @@ using namespace neug::processor; namespace neug { namespace evaluator { -Value ExpressionEvaluatorUtils::evaluateConstantExpression( +compiler_impl::Value ExpressionEvaluatorUtils::evaluateConstantExpression( std::shared_ptr expression, main::ClientContext* clientContext) { auto exprMapper = ExpressionMapper(); diff --git a/src/compiler/common/arrow/arrow_row_batch.cpp b/src/compiler/common/arrow/arrow_row_batch.cpp index ab5a21a18..a0307d462 100644 --- a/src/compiler/common/arrow/arrow_row_batch.cpp +++ b/src/compiler/common/arrow/arrow_row_batch.cpp @@ -246,8 +246,9 @@ void ArrowRowBatch::templateCopyNonNullValue( std::int64_t pos) { auto destAddr = (int64_t*) (vector->data.data() + pos * sizeof(std::int64_t)); auto intervalVal = value->val.intervalVal; - *destAddr = intervalVal.micros + intervalVal.days * Interval::MICROS_PER_DAY + - intervalVal.months * Interval::MICROS_PER_MONTH; + *destAddr = intervalVal.micros + + intervalVal.days * compiler_impl::Interval::MICROS_PER_DAY + + intervalVal.months * compiler_impl::Interval::MICROS_PER_MONTH; } template <> diff --git a/src/compiler/common/copier_config/csv_reader_config.cpp b/src/compiler/common/copier_config/csv_reader_config.cpp index 5c53ba9f8..892d29bf3 100644 --- a/src/compiler/common/copier_config/csv_reader_config.cpp +++ b/src/compiler/common/copier_config/csv_reader_config.cpp @@ -121,7 +121,7 @@ static bool validateIntParsingOptionName(const std::string& parsingOptionName) { return hasOption(CopyConstants::INT_CSV_PARSING_OPTIONS, parsingOptionName); } -static bool isValidBooleanOptionValue(const Value& value, +static bool isValidBooleanOptionValue(const compiler_impl::Value& value, const std::string& name) { // Normalize and check if the string is a valid Boolean representation auto strValue = value.toString(); @@ -140,7 +140,7 @@ static bool isValidBooleanOptionValue(const Value& value, } CSVReaderConfig CSVReaderConfig::construct( - const common::case_insensitive_map_t& options) { + const common::case_insensitive_map_t& options) { auto config = CSVReaderConfig(); for (auto& op : options) { auto name = op.first; diff --git a/src/compiler/common/type_utils.cpp b/src/compiler/common/type_utils.cpp index 6e23133e8..760e08c8b 100644 --- a/src/compiler/common/type_utils.cpp +++ b/src/compiler/common/type_utils.cpp @@ -55,11 +55,14 @@ std::string TypeUtils::entryToString(const DataType& dataType, case DataTypeId::kFloat: return TypeUtils::toString(*reinterpret_cast(value)); case DataTypeId::kDate: - return TypeUtils::toString(*reinterpret_cast(value)); + return TypeUtils::toString( + *reinterpret_cast(value)); case DataTypeId::kTimestampMs: - return TypeUtils::toString(*reinterpret_cast(value)); + return TypeUtils::toString( + *reinterpret_cast(value)); case DataTypeId::kInterval: - return TypeUtils::toString(*reinterpret_cast(value)); + return TypeUtils::toString( + *reinterpret_cast(value)); case DataTypeId::kVarchar: return TypeUtils::toString(*reinterpret_cast(value)); case DataTypeId::kInternalId: @@ -111,24 +114,27 @@ std::string TypeUtils::toString(const internalID_t& val, } template <> -std::string TypeUtils::toString(const date_t& val, void* /*valueVector*/) { - return Date::toString(val); +std::string TypeUtils::toString(const compiler_impl::date_t& val, + void* /*valueVector*/) { + return compiler_impl::Date::toString(val); } template <> -std::string TypeUtils::toString(const timestamp_ms_t& val, +std::string TypeUtils::toString(const compiler_impl::timestamp_ms_t& val, void* /*valueVector*/) { - return toString(Timestamp::fromEpochMilliSeconds(val.value)); + return toString(compiler_impl::Timestamp::fromEpochMilliSeconds(val.value)); } template <> -std::string TypeUtils::toString(const timestamp_t& val, void* /*valueVector*/) { - return Timestamp::toString(val); +std::string TypeUtils::toString(const compiler_impl::timestamp_t& val, + void* /*valueVector*/) { + return compiler_impl::Timestamp::toString(val); } template <> -std::string TypeUtils::toString(const interval_t& val, void* /*valueVector*/) { - return Interval::toString(val); +std::string TypeUtils::toString(const compiler_impl::interval_t& val, + void* /*valueVector*/) { + return compiler_impl::Interval::toString(val); } template <> diff --git a/src/compiler/common/types/date_t.cpp b/src/compiler/common/types/date_t.cpp index 8ff3d35e5..398fd0d4a 100644 --- a/src/compiler/common/types/date_t.cpp +++ b/src/compiler/common/types/date_t.cpp @@ -31,7 +31,12 @@ #include "re2/include/re2.h" namespace neug { -namespace common { +namespace compiler_impl { + +using common::DateToStringCast; +using common::dtime_t; +using common::stringFormat; +using common::StringUtils; date_t::date_t() : days{0} {} @@ -535,5 +540,5 @@ const regex::RE2& Date::regexPattern() { return retval; } -} // namespace common +} // namespace compiler_impl } // namespace neug diff --git a/src/compiler/common/types/dtime_t.cpp b/src/compiler/common/types/dtime_t.cpp index de21946a6..b4d4cb26e 100644 --- a/src/compiler/common/types/dtime_t.cpp +++ b/src/compiler/common/types/dtime_t.cpp @@ -115,7 +115,7 @@ bool Time::tryConvertInternal(const char* buf, uint64_t len, uint64_t& pos, return false; } - if (!Date::parseDoubleDigit(buf, len, pos, min)) { + if (!compiler_impl::Date::parseDoubleDigit(buf, len, pos, min)) { return false; } if (min < 0 || min >= 60) { @@ -130,7 +130,7 @@ bool Time::tryConvertInternal(const char* buf, uint64_t len, uint64_t& pos, return false; } - if (!Date::parseDoubleDigit(buf, len, pos, sec)) { + if (!compiler_impl::Date::parseDoubleDigit(buf, len, pos, sec)) { return false; } if (sec < 0 || sec >= 60) { @@ -177,7 +177,7 @@ bool Time::tryConvertTime(const char* buf, uint64_t len, uint64_t& pos, if (!Time::tryConvertInternal(buf, len, pos, result)) { return false; } - return result.micros < Interval::MICROS_PER_DAY; + return result.micros < compiler_impl::Interval::MICROS_PER_DAY; } dtime_t Time::fromCString(const char* buf, uint64_t len) { @@ -216,10 +216,12 @@ bool Time::isValid(int32_t hour, int32_t minute, int32_t second, dtime_t Time::fromTimeInternal(int32_t hour, int32_t minute, int32_t second, int32_t microseconds) { int64_t result = 0; - result = hour; // hours - result = result * Interval::MINS_PER_HOUR + minute; // hours -> minutes - result = result * Interval::SECS_PER_MINUTE + second; // minutes -> seconds - result = result * Interval::MICROS_PER_SEC + + result = hour; // hours + result = result * compiler_impl::Interval::MINS_PER_HOUR + + minute; // hours -> minutes + result = result * compiler_impl::Interval::SECS_PER_MINUTE + + second; // minutes -> seconds + result = result * compiler_impl::Interval::MICROS_PER_SEC + microseconds; // seconds -> microseconds return dtime_t(result); } @@ -237,12 +239,12 @@ dtime_t Time::fromTime(int32_t hour, int32_t minute, int32_t second, void Time::convert(dtime_t dtime, int32_t& hour, int32_t& min, int32_t& sec, int32_t& micros) { int64_t time = dtime.micros; - hour = int32_t(time / Interval::MICROS_PER_HOUR); - time -= int64_t(hour) * Interval::MICROS_PER_HOUR; - min = int32_t(time / Interval::MICROS_PER_MINUTE); - time -= int64_t(min) * Interval::MICROS_PER_MINUTE; - sec = int32_t(time / Interval::MICROS_PER_SEC); - time -= int64_t(sec) * Interval::MICROS_PER_SEC; + hour = int32_t(time / compiler_impl::Interval::MICROS_PER_HOUR); + time -= int64_t(hour) * compiler_impl::Interval::MICROS_PER_HOUR; + min = int32_t(time / compiler_impl::Interval::MICROS_PER_MINUTE); + time -= int64_t(min) * compiler_impl::Interval::MICROS_PER_MINUTE; + sec = int32_t(time / compiler_impl::Interval::MICROS_PER_SEC); + time -= int64_t(sec) * compiler_impl::Interval::MICROS_PER_SEC; micros = int32_t(time); NEUG_ASSERT(Time::isValid(hour, min, sec, micros)); } diff --git a/src/compiler/common/types/interval_t.cpp b/src/compiler/common/types/interval_t.cpp index 587e5f02c..4d3ab75fd 100644 --- a/src/compiler/common/types/interval_t.cpp +++ b/src/compiler/common/types/interval_t.cpp @@ -34,7 +34,7 @@ #include "re2/include/re2.h" namespace neug { -namespace common { +namespace compiler_impl { interval_t::interval_t() = default; @@ -159,7 +159,8 @@ template void intervalTryAddition(T& target, int64_t input, int64_t multiplier, int64_t fraction = 0) {} -interval_t neug::common::Interval::fromCString(const char* str, uint64_t len) { +compiler_impl::interval_t compiler_impl::Interval::fromCString(const char* str, + uint64_t len) { interval_t result; uint64_t pos = 0; uint64_t startPos = 0; @@ -516,5 +517,5 @@ const regex::RE2& Interval::regexPattern2() { return retval; } -} // namespace common +} // namespace compiler_impl } // namespace neug diff --git a/src/compiler/common/types/timestamp_t.cpp b/src/compiler/common/types/timestamp_t.cpp index 35d8c4ed2..0c0780966 100644 --- a/src/compiler/common/types/timestamp_t.cpp +++ b/src/compiler/common/types/timestamp_t.cpp @@ -28,7 +28,7 @@ #include "neug/utils/exception/exception.h" namespace neug { -namespace common { +namespace compiler_impl { timestamp_t::timestamp_t() : value(0) {} @@ -82,7 +82,7 @@ bool timestamp_t::operator>=(const date_t& rhs) const { return rhs <= *this; } timestamp_t timestamp_t::operator+(const interval_t& interval) const { date_t date{}; date_t result_date{}; - dtime_t time{}; + common::dtime_t time{}; Timestamp::convert(*this, date, time); result_date = date + interval; date = result_date; @@ -127,14 +127,14 @@ bool Timestamp::tryConvertTimestamp(const char* str, uint64_t len, timestamp_t& result) { uint64_t pos = 0; date_t date; - dtime_t time; + common::dtime_t time; if (!Date::tryConvertDate(str, len, pos, date, true /*allowTrailing*/)) { return false; } if (pos == len) { // no time: only a date - result = fromDateTime(date, dtime_t(0)); + result = fromDateTime(date, common::dtime_t(0)); return true; } // try to parse a time field @@ -142,7 +142,7 @@ bool Timestamp::tryConvertTimestamp(const char* str, uint64_t len, pos++; } uint64_t time_pos = 0; - if (!Time::tryConvertTime(str + pos, len - pos, time_pos, time)) { + if (!common::Time::tryConvertTime(str + pos, len - pos, time_pos, time)) { return false; } pos += time_pos; @@ -230,9 +230,9 @@ bool Timestamp::tryParseUTCOffset(const char* str, uint64_t& pos, uint64_t len, std::string Timestamp::toString(timestamp_t timestamp) { date_t date; - dtime_t time; + common::dtime_t time; Timestamp::convert(timestamp, date, time); - return Date::toString(date) + " " + Time::toString(time); + return Date::toString(date) + " " + common::Time::toString(time); } date_t Timestamp::getDate(timestamp_t timestamp) { @@ -241,24 +241,24 @@ date_t Timestamp::getDate(timestamp_t timestamp) { (timestamp.value < 0)); } -dtime_t Timestamp::getTime(timestamp_t timestamp) { +common::dtime_t Timestamp::getTime(timestamp_t timestamp) { date_t date = Timestamp::getDate(timestamp); - return dtime_t(timestamp.value - - (int64_t(date.days) * int64_t(Interval::MICROS_PER_DAY))); + return common::dtime_t(timestamp.value - (int64_t(date.days) * + int64_t(Interval::MICROS_PER_DAY))); } -timestamp_t Timestamp::fromDateTime(date_t date, dtime_t time) { +timestamp_t Timestamp::fromDateTime(date_t date, common::dtime_t time) { timestamp_t result; int32_t year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0, microsecond = -1; Date::convert(date, year, month, day); - Time::convert(time, hour, minute, second, microsecond); + common::Time::convert(time, hour, minute, second, microsecond); result.value = date.days * Interval::MICROS_PER_DAY + time.micros; return result; } void Timestamp::convert(timestamp_t timestamp, date_t& out_date, - dtime_t& out_time) { + common::dtime_t& out_time) { out_date = getDate(timestamp); out_time = getTime(timestamp); } @@ -312,29 +312,30 @@ timestamp_t Timestamp::trunc(DatePartSpecifier specifier, timestamp_t timestamp) { int32_t hour = 0, min = 0, sec = 0, micros = 0; date_t date; - dtime_t time; + common::dtime_t time; Timestamp::convert(timestamp, date, time); - Time::convert(time, hour, min, sec, micros); + common::Time::convert(time, hour, min, sec, micros); switch (specifier) { case DatePartSpecifier::MICROSECOND: return timestamp; case DatePartSpecifier::MILLISECOND: micros -= micros % Interval::MICROS_PER_MSEC; - return Timestamp::fromDateTime(date, - Time::fromTime(hour, min, sec, micros)); + return Timestamp::fromDateTime( + date, common::Time::fromTime(hour, min, sec, micros)); case DatePartSpecifier::SECOND: return Timestamp::fromDateTime( - date, Time::fromTime(hour, min, sec, 0 /* microseconds */)); + date, common::Time::fromTime(hour, min, sec, 0 /* microseconds */)); case DatePartSpecifier::MINUTE: return Timestamp::fromDateTime( - date, Time::fromTime(hour, min, 0 /* seconds */, 0 /* microseconds */)); + date, common::Time::fromTime(hour, min, 0 /* seconds */, + 0 /* microseconds */)); case DatePartSpecifier::HOUR: return Timestamp::fromDateTime( - date, Time::fromTime(hour, 0 /* minutes */, 0 /* seconds */, - 0 /* microseconds */)); + date, common::Time::fromTime(hour, 0 /* minutes */, 0 /* seconds */, + 0 /* microseconds */)); default: date = getDate(timestamp); - return fromDateTime(Date::trunc(specifier, date), dtime_t(0)); + return fromDateTime(Date::trunc(specifier, date), common::dtime_t(0)); } } @@ -359,5 +360,5 @@ timestamp_t Timestamp::getCurrentTimestamp() { duration_cast(now.time_since_epoch()).count()); } -} // namespace common +} // namespace compiler_impl } // namespace neug diff --git a/src/compiler/common/types/types.cpp b/src/compiler/common/types/types.cpp index 02504df0d..1d86c8681 100644 --- a/src/compiler/common/types/types.cpp +++ b/src/compiler/common/types/types.cpp @@ -155,7 +155,7 @@ uint32_t PhysicalTypeUtils::getFixedTypeSize(PhysicalTypeID physicalType) { case PhysicalTypeID::FLOAT: return sizeof(float); case PhysicalTypeID::INTERVAL: - return sizeof(interval_t); + return sizeof(compiler_impl::interval_t); case PhysicalTypeID::INTERNAL_ID: return sizeof(internalID_t); default: diff --git a/src/compiler/common/types/value/nested.cpp b/src/compiler/common/types/value/nested.cpp index e6918ee3e..de4f7deef 100644 --- a/src/compiler/common/types/value/nested.cpp +++ b/src/compiler/common/types/value/nested.cpp @@ -28,11 +28,12 @@ namespace neug { namespace common { -uint32_t NestedVal::getChildrenSize(const Value* val) { +uint32_t NestedVal::getChildrenSize(const compiler_impl::Value* val) { return val->childrenSize; } -Value* NestedVal::getChildVal(const Value* val, uint32_t idx) { +compiler_impl::Value* NestedVal::getChildVal(const compiler_impl::Value* val, + uint32_t idx) { if (idx > val->childrenSize) { THROW_RUNTIME_ERROR("NestedVal::getChildVal index out of bound."); } diff --git a/src/compiler/common/types/value/node.cpp b/src/compiler/common/types/value/node.cpp index 427f7b0f0..c4dbd954f 100644 --- a/src/compiler/common/types/value/node.cpp +++ b/src/compiler/common/types/value/node.cpp @@ -30,10 +30,11 @@ namespace neug { namespace common { -std::vector>> -NodeVal::getProperties(const Value* val) { +std::vector>> +NodeVal::getProperties(const compiler_impl::Value* val) { throwIfNotNode(val); - std::vector>> properties; + std::vector>> + properties; auto fieldNames = StructType::GetFieldNames(val->dataType); for (auto i = 0u; i < val->childrenSize; ++i) { auto currKey = fieldNames[i]; @@ -45,13 +46,14 @@ NodeVal::getProperties(const Value* val) { return properties; } -uint64_t NodeVal::getNumProperties(const Value* val) { +uint64_t NodeVal::getNumProperties(const compiler_impl::Value* val) { throwIfNotNode(val); auto fieldNames = StructType::GetFieldNames(val->dataType); return fieldNames.size() - OFFSET; } -std::string NodeVal::getPropertyName(const Value* val, uint64_t index) { +std::string NodeVal::getPropertyName(const compiler_impl::Value* val, + uint64_t index) { throwIfNotNode(val); auto fieldNames = StructType::GetFieldNames(val->dataType); if (index >= fieldNames.size() - OFFSET) { @@ -60,7 +62,8 @@ std::string NodeVal::getPropertyName(const Value* val, uint64_t index) { return fieldNames[index + OFFSET]; } -Value* NodeVal::getPropertyVal(const Value* val, uint64_t index) { +compiler_impl::Value* NodeVal::getPropertyVal(const compiler_impl::Value* val, + uint64_t index) { throwIfNotNode(val); auto fieldNames = StructType::GetFieldNames(val->dataType); if (index >= fieldNames.size() - OFFSET) { @@ -69,25 +72,25 @@ Value* NodeVal::getPropertyVal(const Value* val, uint64_t index) { return val->children[index + OFFSET].get(); } -Value* NodeVal::getNodeIDVal(const Value* val) { +compiler_impl::Value* NodeVal::getNodeIDVal(const compiler_impl::Value* val) { throwIfNotNode(val); auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::ID); return val->children[fieldIdx].get(); } -Value* NodeVal::getLabelVal(const Value* val) { +compiler_impl::Value* NodeVal::getLabelVal(const compiler_impl::Value* val) { throwIfNotNode(val); auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::LABEL); return val->children[fieldIdx].get(); } -std::string NodeVal::toString(const Value* val) { +std::string NodeVal::toString(const compiler_impl::Value* val) { throwIfNotNode(val); return val->toString(); } -void NodeVal::throwIfNotNode(const Value* val) { +void NodeVal::throwIfNotNode(const compiler_impl::Value* val) { // LCOV_EXCL_START if (val->dataType.id() != DataTypeId::kVertex) { THROW_EXCEPTION_WITH_FILE_LINE(stringFormat( diff --git a/src/compiler/common/types/value/recursive_rel.cpp b/src/compiler/common/types/value/recursive_rel.cpp index fdd68bb59..7693fa6d0 100644 --- a/src/compiler/common/types/value/recursive_rel.cpp +++ b/src/compiler/common/types/value/recursive_rel.cpp @@ -30,17 +30,19 @@ namespace neug { namespace common { -Value* RecursiveRelVal::getNodes(const Value* val) { +compiler_impl::Value* RecursiveRelVal::getNodes( + const compiler_impl::Value* val) { throwIfNotRecursiveRel(val); return val->children[0].get(); } -Value* RecursiveRelVal::getRels(const Value* val) { +compiler_impl::Value* RecursiveRelVal::getRels( + const compiler_impl::Value* val) { throwIfNotRecursiveRel(val); return val->children[1].get(); } -void RecursiveRelVal::throwIfNotRecursiveRel(const Value* val) { +void RecursiveRelVal::throwIfNotRecursiveRel(const compiler_impl::Value* val) { // LCOV_EXCL_START if (val->dataType.id() != DataTypeId::kPath) { THROW_EXCEPTION_WITH_FILE_LINE( diff --git a/src/compiler/common/types/value/rel.cpp b/src/compiler/common/types/value/rel.cpp index 7dc5e329e..0726d1515 100644 --- a/src/compiler/common/types/value/rel.cpp +++ b/src/compiler/common/types/value/rel.cpp @@ -29,10 +29,11 @@ namespace neug { namespace common { -std::vector>> -RelVal::getProperties(const Value* val) { +std::vector>> +RelVal::getProperties(const compiler_impl::Value* val) { throwIfNotRel(val); - std::vector>> properties; + std::vector>> + properties; auto fieldNames = StructType::GetFieldNames(val->dataType); for (auto i = 0u; i < val->childrenSize; ++i) { auto currKey = fieldNames[i]; @@ -46,13 +47,14 @@ RelVal::getProperties(const Value* val) { return properties; } -uint64_t RelVal::getNumProperties(const Value* val) { +uint64_t RelVal::getNumProperties(const compiler_impl::Value* val) { throwIfNotRel(val); auto fieldNames = StructType::GetFieldNames(val->dataType); return fieldNames.size() - OFFSET; } -std::string RelVal::getPropertyName(const Value* val, uint64_t index) { +std::string RelVal::getPropertyName(const compiler_impl::Value* val, + uint64_t index) { throwIfNotRel(val); auto fieldNames = StructType::GetFieldNames(val->dataType); if (index >= fieldNames.size() - OFFSET) { @@ -61,7 +63,8 @@ std::string RelVal::getPropertyName(const Value* val, uint64_t index) { return fieldNames[index + OFFSET]; } -Value* RelVal::getPropertyVal(const Value* val, uint64_t index) { +compiler_impl::Value* RelVal::getPropertyVal(const compiler_impl::Value* val, + uint64_t index) { throwIfNotRel(val); auto fieldNames = StructType::GetFieldNames(val->dataType); if (index >= fieldNames.size() - OFFSET) { @@ -70,33 +73,33 @@ Value* RelVal::getPropertyVal(const Value* val, uint64_t index) { return val->children[index + OFFSET].get(); } -Value* RelVal::getIDVal(const Value* val) { +compiler_impl::Value* RelVal::getIDVal(const compiler_impl::Value* val) { auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::ID); return val->children[fieldIdx].get(); } -Value* RelVal::getSrcNodeIDVal(const Value* val) { +compiler_impl::Value* RelVal::getSrcNodeIDVal(const compiler_impl::Value* val) { auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::SRC); return val->children[fieldIdx].get(); } -Value* RelVal::getDstNodeIDVal(const Value* val) { +compiler_impl::Value* RelVal::getDstNodeIDVal(const compiler_impl::Value* val) { auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::DST); return val->children[fieldIdx].get(); } -Value* RelVal::getLabelVal(const Value* val) { +compiler_impl::Value* RelVal::getLabelVal(const compiler_impl::Value* val) { auto fieldIdx = StructType::GetFieldIdx(val->dataType, InternalKeyword::LABEL); return val->children[fieldIdx].get(); } -std::string RelVal::toString(const Value* val) { +std::string RelVal::toString(const compiler_impl::Value* val) { throwIfNotRel(val); return val->toString(); } -void RelVal::throwIfNotRel(const Value* val) { +void RelVal::throwIfNotRel(const compiler_impl::Value* val) { // LCOV_EXCL_START if (val->dataType.id() != DataTypeId::kEdge) { THROW_EXCEPTION_WITH_FILE_LINE(stringFormat( diff --git a/src/compiler/common/types/value/value.cpp b/src/compiler/common/types/value/value.cpp index a6ea5da0e..7627c67af 100644 --- a/src/compiler/common/types/value/value.cpp +++ b/src/compiler/common/types/value/value.cpp @@ -24,6 +24,7 @@ #include +#include "neug/compiler/common/constants.h" #include "neug/compiler/common/null_buffer.h" #include "neug/compiler/common/serializer/deserializer.h" #include "neug/compiler/common/serializer/serializer.h" @@ -33,7 +34,24 @@ #include "neug/utils/exception/exception.h" namespace neug { -namespace common { +namespace compiler_impl { + +using common::DataType; +using common::DataTypeId; +using common::getPhysicalType; +using common::InMemOverflowBuffer; +using common::InternalKeyword; +using common::ListType; +using common::ListVector; +using common::neug_string_t; +using common::NullMask; +using common::PhysicalTypeID; +using common::stringFormat; +using common::StringVector; +using common::StructType; +using common::StructVector; +using common::TypeUtils; +using common::ValueVector; bool Value::operator==(const Value& rhs) const { if (dataType != rhs.dataType || isNull_ != rhs.isNull_) { @@ -872,5 +890,5 @@ std::string Value::relToString() const { return result; } -} // namespace common +} // namespace compiler_impl } // namespace neug diff --git a/src/compiler/common/vector/value_vector.cpp b/src/compiler/common/vector/value_vector.cpp index 3e77fc15a..090d3f0aa 100644 --- a/src/compiler/common/vector/value_vector.cpp +++ b/src/compiler/common/vector/value_vector.cpp @@ -190,7 +190,8 @@ void ValueVector::copyFromVectorData(uint64_t dstPos, } } -void ValueVector::copyFromValue(uint64_t pos, const Value& value) { +void ValueVector::copyFromValue(uint64_t pos, + const compiler_impl::Value& value) { if (value.isNull()) { setNull(pos, true); return; @@ -271,8 +272,9 @@ void ValueVector::copyFromValue(uint64_t pos, const Value& value) { } } -std::unique_ptr ValueVector::getAsValue(uint64_t pos) const { - auto value = Value::createNullValue(dataType).copy(); +std::unique_ptr ValueVector::getAsValue( + uint64_t pos) const { + auto value = compiler_impl::Value::createNullValue(dataType).copy(); if (isNull(pos)) { return value; } @@ -316,7 +318,7 @@ std::unique_ptr ValueVector::getAsValue(uint64_t pos) const { value->val.booleanVal = getValue(pos); } break; case PhysicalTypeID::INTERVAL: { - value->val.intervalVal = getValue(pos); + value->val.intervalVal = getValue(pos); } break; case PhysicalTypeID::STRING: { value->strVal = getValue(pos).getAsString(); @@ -325,7 +327,7 @@ std::unique_ptr ValueVector::getAsValue(uint64_t pos) const { case PhysicalTypeID::LIST: { auto dataVector = ListVector::getDataVector(this); auto listEntry = getValue(pos); - std::vector> children; + std::vector> children; children.reserve(listEntry.size); for (auto i = 0u; i < listEntry.size; ++i) { children.push_back(dataVector->getAsValue(listEntry.offset + i)); @@ -335,7 +337,7 @@ std::unique_ptr ValueVector::getAsValue(uint64_t pos) const { } break; case PhysicalTypeID::STRUCT: { auto& fieldVectors = StructVector::getFieldVectors(this); - std::vector> children; + std::vector> children; children.reserve(fieldVectors.size()); for (auto& fieldVector : fieldVectors) { children.push_back(fieldVector->getAsValue(pos)); @@ -451,7 +453,7 @@ std::unique_ptr ValueVector::deSerialize( } deSer.validateDebuggingInfo(key, "values"); for (auto i = 0u; i < numValues; i++) { - auto val = Value::deserialize(deSer); + auto val = compiler_impl::Value::deserialize(deSer); result->copyFromValue(result->state->getSelVector()[i], *val); } return result; @@ -479,13 +481,14 @@ template NEUG_API void ValueVector::setValue(uint32_t pos, int128_t val); template NEUG_API void ValueVector::setValue(uint32_t pos, double val); template NEUG_API void ValueVector::setValue(uint32_t pos, float val); -template NEUG_API void ValueVector::setValue(uint32_t pos, date_t val); -template NEUG_API void ValueVector::setValue(uint32_t pos, - timestamp_t val); -template NEUG_API void ValueVector::setValue( - uint32_t pos, timestamp_ms_t val); -template NEUG_API void ValueVector::setValue(uint32_t pos, - interval_t val); +template NEUG_API void ValueVector::setValue( + uint32_t pos, compiler_impl::date_t val); +template NEUG_API void ValueVector::setValue( + uint32_t pos, compiler_impl::timestamp_t val); +template NEUG_API void ValueVector::setValue( + uint32_t pos, compiler_impl::timestamp_ms_t val); +template NEUG_API void ValueVector::setValue( + uint32_t pos, compiler_impl::interval_t val); template NEUG_API void ValueVector::setValue(uint32_t pos, list_entry_t val); diff --git a/src/compiler/function/cast_from_string_functions.cpp b/src/compiler/function/cast_from_string_functions.cpp index 63135d82d..312a273da 100644 --- a/src/compiler/function/cast_from_string_functions.cpp +++ b/src/compiler/function/cast_from_string_functions.cpp @@ -132,37 +132,39 @@ inline void CastStringHelper::cast(const char* input, uint64_t len, template <> inline void CastStringHelper::cast(const char* input, uint64_t len, - date_t& result, ValueVector* /*vector*/, + compiler_impl::date_t& result, + ValueVector* /*vector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = Date::fromCString(input, len); + result = compiler_impl::Date::fromCString(input, len); } template <> inline void CastStringHelper::cast(const char* input, uint64_t len, - timestamp_ms_t& result, + compiler_impl::timestamp_ms_t& result, ValueVector* /*vector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - TryCastStringToTimestamp::cast(input, len, result, - DataTypeId::kTimestampMs); + TryCastStringToTimestamp::cast( + input, len, result, DataTypeId::kTimestampMs); } template <> inline void CastStringHelper::cast(const char* input, uint64_t len, - neug::common::timestamp_t& result, + compiler_impl::timestamp_t& result, ValueVector* /*vector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = Timestamp::fromCString(input, len); + result = compiler_impl::Timestamp::fromCString(input, len); } template <> inline void CastStringHelper::cast(const char* input, uint64_t len, - interval_t& result, ValueVector* /*vector*/, + compiler_impl::interval_t& result, + ValueVector* /*vector*/, uint64_t /*rowToAdd*/, const CSVOption* /*option*/) { - result = neug::common::Interval::fromCString(input, len); + result = compiler_impl::Interval::fromCString(input, len); } // ---------------------- cast String to nested types @@ -445,7 +447,7 @@ bool SplitStringMapOperation::handleKey(const char* start, const char* end, if (fieldVector->isNull(offset)) { THROW_CONVERSION_EXCEPTION("Map does not allow null as key."); } - auto val = common::Value::createDefaultValue(fieldVector->dataType); + auto val = compiler_impl::Value::createDefaultValue(fieldVector->dataType); val.copyFromColLayout( fieldVector->getData() + fieldVector->getNumBytesPerValue() * offset, fieldVector); @@ -760,18 +762,18 @@ void CastString::copyStringToVector(ValueVector* vector, uint64_t vectorPos, StringVector::addString(vector, vectorPos, strVal.data(), strVal.length()); } break; case DataTypeId::kDate: { - date_t val; + compiler_impl::date_t val; CastStringHelper::cast(strVal.data(), strVal.length(), val); vector->setValue(vectorPos, val); } break; case DataTypeId::kTimestampMs: { - timestamp_ms_t val; + compiler_impl::timestamp_ms_t val; CastStringHelper::cast(strVal.data(), strVal.length(), val); vector->setValue(vectorPos, val); } break; // TIMESTAMP removed — merged into kTimestampMs case DataTypeId::kInterval: { - interval_t val; + compiler_impl::interval_t val; CastStringHelper::cast(strVal.data(), strVal.length(), val); vector->setValue(vectorPos, val); } break; diff --git a/src/compiler/function/cast_string_non_nested_functions.cpp b/src/compiler/function/cast_string_non_nested_functions.cpp index 94635afee..a96104b98 100644 --- a/src/compiler/function/cast_string_non_nested_functions.cpp +++ b/src/compiler/function/cast_string_non_nested_functions.cpp @@ -83,42 +83,42 @@ void castStringToBool(const char* input, uint64_t len, bool& result) { } template <> -bool TryCastStringToTimestamp::tryCast( - const char* input, uint64_t len, neug::common::timestamp_t& result) { - if (!Timestamp::tryConvertTimestamp(input, len, result)) { +bool TryCastStringToTimestamp::tryCast( + const char* input, uint64_t len, compiler_impl::timestamp_t& result) { + if (!compiler_impl::Timestamp::tryConvertTimestamp(input, len, result)) { return false; } - result = Timestamp::getEpochNanoSeconds(result); + result = compiler_impl::Timestamp::getEpochNanoSeconds(result); return true; } template <> -bool TryCastStringToTimestamp::tryCast( - const char* input, uint64_t len, neug::common::timestamp_t& result) { - if (!Timestamp::tryConvertTimestamp(input, len, result)) { +bool TryCastStringToTimestamp::tryCast( + const char* input, uint64_t len, compiler_impl::timestamp_t& result) { + if (!compiler_impl::Timestamp::tryConvertTimestamp(input, len, result)) { return false; } - result = Timestamp::getEpochMilliSeconds(result); + result = compiler_impl::Timestamp::getEpochMilliSeconds(result); return true; } template <> -bool TryCastStringToTimestamp::tryCast( - const char* input, uint64_t len, neug::common::timestamp_t& result) { - if (!Timestamp::tryConvertTimestamp(input, len, result)) { +bool TryCastStringToTimestamp::tryCast( + const char* input, uint64_t len, compiler_impl::timestamp_t& result) { + if (!compiler_impl::Timestamp::tryConvertTimestamp(input, len, result)) { return false; } - result = Timestamp::getEpochSeconds(result); + result = compiler_impl::Timestamp::getEpochSeconds(result); return true; } static bool isDate(std::string_view str) { - return RE2::FullMatch(str, Date::regexPattern()); + return RE2::FullMatch(str, compiler_impl::Date::regexPattern()); } static bool isInterval(std::string_view str) { - return RE2::FullMatch(str, Interval::regexPattern1()) || - RE2::FullMatch(str, Interval::regexPattern2()); + return RE2::FullMatch(str, compiler_impl::Interval::regexPattern1()) || + RE2::FullMatch(str, compiler_impl::Interval::regexPattern2()); } static DataType inferMapOrStruct(std::string_view str) { @@ -243,8 +243,9 @@ DataType inferMinimalTypeFromString(std::string_view str) { return DataType(DataTypeId::kDate); } // It might just be quicker to try cast to timestamp. - neug::common::timestamp_t tmp; - if (common::Timestamp::tryConvertTimestamp(cpy.data(), cpy.length(), tmp)) { + compiler_impl::timestamp_t tmp; + if (compiler_impl::Timestamp::tryConvertTimestamp(cpy.data(), cpy.length(), + tmp)) { return DataType(DataTypeId::kTimestampMs); } diff --git a/src/compiler/function/comparison_functions.cpp b/src/compiler/function/comparison_functions.cpp index 04feadc7c..b9c000277 100644 --- a/src/compiler/function/comparison_functions.cpp +++ b/src/compiler/function/comparison_functions.cpp @@ -101,9 +101,9 @@ static void executeNestedOperation(uint8_t& result, ValueVector* leftVector, nullptr /* left */, nullptr /* right */); } break; case PhysicalTypeID::INTERVAL: { - OP::operation(leftVector->getValue(leftPos), - rightVector->getValue(rightPos), result, - nullptr /* left */, nullptr /* right */); + OP::operation(leftVector->getValue(leftPos), + rightVector->getValue(rightPos), + result, nullptr /* left */, nullptr /* right */); } break; case PhysicalTypeID::INTERNAL_ID: { OP::operation(leftVector->getValue(leftPos), diff --git a/src/compiler/function/gds/gds_algo_function.cpp b/src/compiler/function/gds/gds_algo_function.cpp index b28075897..7ffd85c95 100644 --- a/src/compiler/function/gds/gds_algo_function.cpp +++ b/src/compiler/function/gds/gds_algo_function.cpp @@ -33,7 +33,7 @@ namespace function { namespace { -static std::string extractOptionValue(const common::Value& val) { +static std::string extractOptionValue(const compiler_impl::Value& val) { if (val.isNull()) { return ""; } @@ -61,7 +61,7 @@ static std::string extractOptionValue(const common::Value& val) { } static common::case_insensitive_map_t extractStringOptions( - const common::Value& value) { + const compiler_impl::Value& value) { common::case_insensitive_map_t out; const auto typeId = value.getDataType().id(); if (typeId == common::DataTypeId::kStruct) { diff --git a/src/compiler/function/gds/project_graph_function.cpp b/src/compiler/function/gds/project_graph_function.cpp index 4edbcab11..38134fa7c 100644 --- a/src/compiler/function/gds/project_graph_function.cpp +++ b/src/compiler/function/gds/project_graph_function.cpp @@ -17,6 +17,7 @@ #include "neug/compiler/function/gds/project_graph_function.h" #include +#include "neug/common/columns/value_columns.h" #include "neug/compiler/common/string_format.h" #include "neug/compiler/common/types/types.h" #include "neug/compiler/common/types/value/nested.h" @@ -27,7 +28,6 @@ #include "neug/compiler/main/client_context.h" #include "neug/compiler/main/metadata_manager.h" #include "neug/compiler/main/metadata_registry.h" -#include "neug/execution/common/columns/value_columns.h" #include "neug/execution/common/context.h" #include "neug/storages/graph/graph_interface.h" #include "neug/utils/exception/exception.h" @@ -53,12 +53,12 @@ struct ProjectedGraphInfoCallInput : public CallFuncInputBase { std::string graphName; }; -static std::string getStringVal(const common::Value& value) { +static std::string getStringVal(const compiler_impl::Value& value) { value.validateType(common::DataTypeId::kVarchar); return value.getValue(); } -static std::vector getListVal(const common::Value& value) { +static std::vector getListVal(const compiler_impl::Value& value) { std::vector vals; for (auto i = 0u; i < common::NestedVal::getChildrenSize(&value); ++i) { const auto& childValue = *common::NestedVal::getChildVal(&value, i); @@ -68,7 +68,7 @@ static std::vector getListVal(const common::Value& value) { } static std::vector -extractGraphEntryTableInfos(const common::Value& value) { +extractGraphEntryTableInfos(const compiler_impl::Value& value) { std::vector infos; switch (value.getDataType().id()) { case common::DataTypeId::kArray: @@ -277,7 +277,7 @@ function_set ShowProjectedGraphsFunction::getFunctionSet() { function->execFunc = [](const CallFuncInputBase& /*input*/, neug::IStorageInterface& /*graph*/) { neug::execution::Context out; - neug::execution::ValueColumnBuilder name_builder; + neug::ValueColumnBuilder name_builder; auto metadataManager = main::MetadataRegistry::getMetadata(); if (metadataManager == nullptr) { THROW_INVALID_ARGUMENT_EXCEPTION("Metadata manager is not set"); @@ -288,7 +288,7 @@ function_set ShowProjectedGraphsFunction::getFunctionSet() { for (const auto& [name, _] : nameToEntryMap) { name_builder.push_back_opt(name); } - execution::DataChunk chunk; + neug::DataChunk chunk; chunk.set(0, name_builder.finish()); out.append_chunk(std::move(chunk)); out.tag_ids = {0}; @@ -330,8 +330,8 @@ function_set ProjectedGraphInfoFunction::getFunctionSet() { function->execFunc = [](const CallFuncInputBase& input, neug::IStorageInterface& /*graph*/) { neug::execution::Context out; - neug::execution::ValueColumnBuilder name_builder; - neug::execution::ValueColumnBuilder predicate_builder; + neug::ValueColumnBuilder name_builder; + neug::ValueColumnBuilder predicate_builder; auto metadataManager = main::MetadataRegistry::getMetadata(); if (metadataManager == nullptr) { THROW_INVALID_ARGUMENT_EXCEPTION("Metadata manager is not set"); @@ -355,7 +355,7 @@ function_set ProjectedGraphInfoFunction::getFunctionSet() { name_builder.push_back_opt(std::move(triplets)); predicate_builder.push_back_opt(relInfo.predicate); } - execution::DataChunk chunk; + neug::DataChunk chunk; chunk.set(0, name_builder.finish()); chunk.set(1, predicate_builder.finish()); out.append_chunk(std::move(chunk)); diff --git a/src/compiler/function/list/list_extract_function.cpp b/src/compiler/function/list/list_extract_function.cpp index 4e15aebbb..942ddd197 100644 --- a/src/compiler/function/list/list_extract_function.cpp +++ b/src/compiler/function/list/list_extract_function.cpp @@ -22,18 +22,17 @@ #include "neug/compiler/function/list/functions/list_extract_function.h" -#include "neug/common/types.h" +#include "neug/common/types/value.h" #include "neug/compiler/function/list/vector_list_functions.h" #include "neug/compiler/function/neug_scalar_function.h" #include "neug/compiler/function/scalar_function.h" -#include "neug/execution/common/types/value.h" using namespace neug::common; namespace neug { namespace function { -static int checkAndGetIndex(const execution::Value& value) { +static int checkAndGetIndex(const neug::Value& value) { switch (value.type().id()) { case neug::DataTypeId::kUInt32: return value.GetValue(); @@ -51,7 +50,7 @@ static int checkAndGetIndex(const execution::Value& value) { } } -static execution::Value execFunc(const std::vector& args) { +static neug::Value execFunc(const std::vector& args) { if (args.size() != 2) { THROW_RUNTIME_ERROR( "LIST_EXTRACT([], index): expect exactly 2 argument, got " + @@ -61,11 +60,11 @@ static execution::Value execFunc(const std::vector& args) { const auto& arg0 = args[0]; switch (arg0.type().id()) { case neug::DataTypeId::kStruct: - return execution::StructValue::GetChildren(arg0).at(index); + return neug::StructValue::GetChildren(arg0).at(index); case neug::DataTypeId::kList: - return execution::ListValue::GetChildren(arg0).at(index); + return neug::ListValue::GetChildren(arg0).at(index); case neug::DataTypeId::kArray: - return execution::ArrayValue::GetChildren(arg0).at(index); + return neug::ArrayValue::GetChildren(arg0).at(index); default: THROW_RUNTIME_ERROR( "LIST_EXTRACT([], index): the first element should be a tuple or a " diff --git a/src/compiler/function/list/list_unique_function.cpp b/src/compiler/function/list/list_unique_function.cpp index 973b30f80..c4d796d38 100644 --- a/src/compiler/function/list/list_unique_function.cpp +++ b/src/compiler/function/list/list_unique_function.cpp @@ -37,7 +37,7 @@ uint64_t ListUnique::appendListElementsToValueSet( null_value_handler nullValueHandler) { ValueSet uniqueKeys; auto dataVector = common::ListVector::getDataVector(&inputVector); - auto val = common::Value::createDefaultValue(dataVector->dataType); + auto val = compiler_impl::Value::createDefaultValue(dataVector->dataType); for (auto i = 0u; i < input.size; i++) { if (dataVector->isNull(input.offset + i)) { if (nullValueHandler != nullptr) { diff --git a/src/compiler/function/path/length_function.cpp b/src/compiler/function/path/length_function.cpp index ca628eab5..a1a414ad7 100644 --- a/src/compiler/function/path/length_function.cpp +++ b/src/compiler/function/path/length_function.cpp @@ -49,7 +49,8 @@ static std::shared_ptr rewriteFunc( recursiveRels.push_back(child->constPtrCast()); } } - auto numRelsExpression = binder->createLiteralExpression(Value(numRels)); + auto numRelsExpression = + binder->createLiteralExpression(compiler_impl::Value(numRels)); if (recursiveRels.empty()) { return numRelsExpression; } diff --git a/src/compiler/function/pattern/label_function.cpp b/src/compiler/function/pattern/label_function.cpp index cc90c40fd..e309bdbc5 100644 --- a/src/compiler/function/pattern/label_function.cpp +++ b/src/compiler/function/pattern/label_function.cpp @@ -78,17 +78,19 @@ static std::shared_ptr getLabelsAsLiteral( maxTableID = entry->getTableID(); } } - std::vector> labels; + std::vector> labels; labels.resize(maxTableID + 1); for (auto i = 0u; i < labels.size(); ++i) { if (map.contains(i)) { - labels[i] = std::make_unique(DataType::Varchar(), map.at(i)); + labels[i] = std::make_unique(DataType::Varchar(), + map.at(i)); } else { - labels[i] = std::make_unique(DataType::Varchar(), std::string("")); + labels[i] = std::make_unique(DataType::Varchar(), + std::string("")); } } - auto labelsValue = - Value(DataType::List(DataType::Varchar()), std::move(labels)); + auto labelsValue = compiler_impl::Value(DataType::List(DataType::Varchar()), + std::move(labels)); return expressionBinder->createLiteralExpression(labelsValue); } diff --git a/src/compiler/function/show_loaded_extensions_function.cpp b/src/compiler/function/show_loaded_extensions_function.cpp index efa2a56dc..c7f464a96 100644 --- a/src/compiler/function/show_loaded_extensions_function.cpp +++ b/src/compiler/function/show_loaded_extensions_function.cpp @@ -16,8 +16,8 @@ #include "neug/compiler/function/show_loaded_extensions_function.h" #include +#include "neug/common/columns/value_columns.h" #include "neug/compiler/extension/extension_api.h" -#include "neug/execution/common/columns/value_columns.h" #include "neug/execution/common/context.h" #include "neug/utils/exception/exception.h" @@ -46,8 +46,8 @@ function_set ShowLoadedExtensionsFunction::getFunctionSet() { const auto& ext_map = neug::extension::ExtensionAPI::getLoadedExtensions(); - neug::execution::ValueColumnBuilder name_builder; - neug::execution::ValueColumnBuilder desc_builder; + neug::ValueColumnBuilder name_builder; + neug::ValueColumnBuilder desc_builder; name_builder.reserve(ext_map.size()); desc_builder.reserve(ext_map.size()); @@ -59,7 +59,7 @@ function_set ShowLoadedExtensionsFunction::getFunctionSet() { desc_builder.push_back_opt(desc_view); } - neug::execution::DataChunk chunk; + neug::DataChunk chunk; chunk.set(0, name_builder.finish()); chunk.set(1, desc_builder.finish()); ctx.append_chunk(std::move(chunk)); diff --git a/src/compiler/function/table/bind_input.cpp b/src/compiler/function/table/bind_input.cpp index 12cdd6d7b..a5e2fabb9 100644 --- a/src/compiler/function/table/bind_input.cpp +++ b/src/compiler/function/table/bind_input.cpp @@ -28,12 +28,12 @@ namespace neug { namespace function { -void TableFuncBindInput::addLiteralParam(common::Value value) { +void TableFuncBindInput::addLiteralParam(compiler_impl::Value value) { params.push_back( std::make_shared(std::move(value), "")); } -common::Value TableFuncBindInput::getValue(common::idx_t idx) const { +compiler_impl::Value TableFuncBindInput::getValue(common::idx_t idx) const { binder::ExpressionUtil::validateExpressionType( *params[idx], common::ExpressionType::LITERAL); return params[idx]->constCast().getValue(); diff --git a/src/compiler/function/vector_arithmetic_functions.cpp b/src/compiler/function/vector_arithmetic_functions.cpp index 4f32d76bb..e913c7881 100644 --- a/src/compiler/function/vector_arithmetic_functions.cpp +++ b/src/compiler/function/vector_arithmetic_functions.cpp @@ -110,42 +110,51 @@ function_set AddFunction::getFunctionSet() { ScalarFunction::BinaryExecListStructFunction); // interval + interval → interval - result.push_back(getBinaryFunction( + result.push_back(getBinaryFunction( name, DataTypeId::kInterval, DataTypeId::kInterval)); // date + int → date result.push_back(make_unique( name, std::vector{DataTypeId::kDate, DataTypeId::kInt64}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // int + date → date result.push_back(make_unique( name, std::vector{DataTypeId::kInt64, DataTypeId::kDate}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // date + interval → date result.push_back(make_unique( name, std::vector{DataTypeId::kDate, DataTypeId::kInterval}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // interval + date → date result.push_back(make_unique( name, std::vector{DataTypeId::kInterval, DataTypeId::kDate}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // timestamp + interval → timestamp result.push_back(make_unique( name, std::vector{DataTypeId::kTimestampMs, DataTypeId::kInterval}, DataTypeId::kTimestampMs, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // interval + timestamp → timestamp result.push_back(make_unique( name, std::vector{DataTypeId::kInterval, DataTypeId::kTimestampMs}, DataTypeId::kTimestampMs, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); return result; } @@ -155,32 +164,36 @@ function_set SubtractFunction::getFunctionSet() { result.push_back(getBinaryFunction(name, typeID)); } // date - date → interval - result.push_back(getBinaryFunction( + result.push_back(getBinaryFunction( name, DataTypeId::kDate, DataTypeId::kInterval)); // date - integer → date result.push_back(make_unique( name, std::vector{DataTypeId::kDate, DataTypeId::kInt64}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // date - interval → date result.push_back(make_unique( name, std::vector{DataTypeId::kDate, DataTypeId::kInterval}, DataTypeId::kDate, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); // timestamp - timestamp → interval - result.push_back( - getBinaryFunction( - name, DataTypeId::kTimestampMs, DataTypeId::kInterval)); + result.push_back(getBinaryFunction( + name, DataTypeId::kTimestampMs, DataTypeId::kInterval)); // timestamp - interval → timestamp result.push_back(make_unique( name, std::vector{DataTypeId::kTimestampMs, DataTypeId::kInterval}, DataTypeId::kTimestampMs, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction< + compiler_impl::timestamp_t, compiler_impl::interval_t, + compiler_impl::timestamp_t, Subtract>)); // interval - interval → interval - result.push_back(getBinaryFunction( + result.push_back(getBinaryFunction( name, DataTypeId::kInterval, DataTypeId::kInterval)); return result; } @@ -202,8 +215,8 @@ function_set DivideFunction::getFunctionSet() { result.push_back(make_unique( name, std::vector{DataTypeId::kInterval, DataTypeId::kInt64}, DataTypeId::kInterval, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); return result; } diff --git a/src/compiler/function/vector_cast_functions.cpp b/src/compiler/function/vector_cast_functions.cpp index 17bf3d4a9..6ed5b634b 100644 --- a/src/compiler/function/vector_cast_functions.cpp +++ b/src/compiler/function/vector_cast_functions.cpp @@ -24,6 +24,7 @@ #include #include +#include "neug/common/types/value.h" #include "neug/compiler/binder/expression/expression_util.h" #include "neug/compiler/binder/expression/literal_expression.h" #include "neug/compiler/catalog/catalog.h" @@ -35,7 +36,6 @@ #include "neug/compiler/function/neug_scalar_function.h" #include "neug/compiler/function/scalar_function.h" #include "neug/compiler/main/client_context.h" -#include "neug/execution/common/types/value.h" #include "neug/utils/exception/exception.h" using namespace neug::common; @@ -265,18 +265,16 @@ static std::unique_ptr bindCastFromStringFunction( scalar_func_exec_t execFunc; switch (targetType.id()) { case DataTypeId::kDate: { - execFunc = - ScalarFunction::UnaryCastStringExecFunction; + execFunc = ScalarFunction::UnaryCastStringExecFunction< + neug_string_t, compiler_impl::date_t, CastString, EXECUTOR>; } break; case DataTypeId::kTimestampMs: { execFunc = ScalarFunction::UnaryCastStringExecFunction< - neug_string_t, timestamp_ms_t, CastString, EXECUTOR>; + neug_string_t, compiler_impl::timestamp_ms_t, CastString, EXECUTOR>; } break; case DataTypeId::kInterval: { - execFunc = - ScalarFunction::UnaryCastStringExecFunction; + execFunc = ScalarFunction::UnaryCastStringExecFunction< + neug_string_t, compiler_impl::interval_t, CastString, EXECUTOR>; } break; case DataTypeId::kVarchar: { execFunc = @@ -413,16 +411,16 @@ static std::unique_ptr bindCastToStringFunction( CastToString, EXECUTOR>; } break; case DataTypeId::kDate: { - func = ScalarFunction::UnaryCastExecFunction; + func = ScalarFunction::UnaryCastExecFunction< + compiler_impl::date_t, neug_string_t, CastToString, EXECUTOR>; } break; case DataTypeId::kTimestampMs: { - func = ScalarFunction::UnaryCastExecFunction; + func = ScalarFunction::UnaryCastExecFunction< + compiler_impl::timestamp_ms_t, neug_string_t, CastToString, EXECUTOR>; } break; case DataTypeId::kInterval: { - func = ScalarFunction::UnaryCastExecFunction; + func = ScalarFunction::UnaryCastExecFunction< + compiler_impl::interval_t, neug_string_t, CastToString, EXECUTOR>; } break; case DataTypeId::kInternalId: { func = ScalarFunction::UnaryCastExecFunction bindCastToDateFunction( scalar_func_exec_t func; switch (sourceType.id()) { case DataTypeId::kTimestampMs: - func = ScalarFunction::UnaryExecFunction; + func = ScalarFunction::UnaryExecFunction; break; // LCOV_EXCL_START default: @@ -560,12 +558,13 @@ static std::unique_ptr bindCastToTimestampFunction( scalar_func_exec_t func; switch (sourceType.id()) { case DataTypeId::kDate: { - func = ScalarFunction::UnaryExecFunction; } break; case DataTypeId::kTimestampMs: { - func = ScalarFunction::UnaryExecFunction; + func = ScalarFunction::UnaryExecFunction; } break; default: THROW_CONVERSION_EXCEPTION( @@ -631,11 +630,11 @@ std::unique_ptr CastFunction::bindCastFunction( functionName, sourceType, targetType); } case DataTypeId::kDate: { - return bindCastToDateFunction(functionName, sourceType, - targetType); + return bindCastToDateFunction( + functionName, sourceType, targetType); } case DataTypeId::kTimestampMs: { - return bindCastToTimestampFunction( + return bindCastToTimestampFunction( functionName, sourceType, targetType); } case DataTypeId::kList: @@ -710,39 +709,39 @@ static std::unique_ptr castBindFunc( return bindData; } -static execution::Value castFunc(const std::vector& args) { +static neug::Value castFunc(const std::vector& args) { if (args.size() != 2) { THROW_RUNTIME_ERROR("CAST(VAL, TYPE): expect exactly 2 argument, got " + std::to_string(args.size())); } const auto& arg0 = args[0]; const auto& arg1 = args[1]; - auto type = execution::StringValue::Get(arg1); + auto type = StringValue::Get(arg1); auto targetType = common::convertFromString(std::string(type), nullptr); switch (targetType.id()) { case DataTypeId::kInt64: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kInt32: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kFloat: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kDouble: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kVarchar: - return execution::performCastToString(arg0); + return performCastToString(arg0); case DataTypeId::kDate: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kTimestampMs: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kUInt32: - return execution::performCast(arg0); + return performCast(arg0); case DataTypeId::kUInt64: - return execution::performCast(arg0); + return performCast(arg0); default: THROW_RUNTIME_ERROR(std::string("Unsupported target type for CAST: ") + std::string(type)); } - return execution::Value(DataType::SQLNULL); + return neug::Value(DataType::SQLNULL); } function_set CastAnyFunction::getFunctionSet() { diff --git a/src/compiler/function/vector_date_functions.cpp b/src/compiler/function/vector_date_functions.cpp index d87f4757f..ae130e332 100644 --- a/src/compiler/function/vector_date_functions.cpp +++ b/src/compiler/function/vector_date_functions.cpp @@ -35,31 +35,31 @@ function_set DatePartFunction::getFunctionSet() { result.push_back(make_unique( name, std::vector{DataTypeId::kVarchar, DataTypeId::kDate}, DataTypeId::kInt64, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction)); result.push_back(make_unique( name, std::vector{DataTypeId::kVarchar, DataTypeId::kTimestampMs}, DataTypeId::kInt64, ScalarFunction::BinaryExecFunction< - neug_string_t, neug::common::timestamp_t, int64_t, DatePart>)); + neug_string_t, compiler_impl::timestamp_t, int64_t, DatePart>)); result.push_back(make_unique( name, std::vector{DataTypeId::kVarchar, DataTypeId::kInterval}, DataTypeId::kInt64, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction< + neug_string_t, compiler_impl::interval_t, int64_t, DatePart>)); result.push_back(make_unique( name, std::vector{DataTypeId::kVarchar, DataTypeId::kDate}, DataTypeId::kInt64, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction< + neug_string_t, compiler_impl::interval_t, int64_t, DatePart>)); result.push_back(make_unique( name, std::vector{DataTypeId::kVarchar, DataTypeId::kTimestampMs}, DataTypeId::kInt64, - ScalarFunction::BinaryExecFunction)); + ScalarFunction::BinaryExecFunction< + neug_string_t, compiler_impl::interval_t, int64_t, DatePart>)); return result; } diff --git a/src/compiler/function/vector_string_functions.cpp b/src/compiler/function/vector_string_functions.cpp index f1eb3a2e9..cabdb5d7b 100644 --- a/src/compiler/function/vector_string_functions.cpp +++ b/src/compiler/function/vector_string_functions.cpp @@ -25,7 +25,7 @@ #include "neug/compiler/function/neug_scalar_function.h" #include "neug/compiler/function/string/functions/array_extract_function.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" using namespace neug::common; @@ -64,8 +64,7 @@ function_set UpperFunction::getFunctionSet() { return functionSet; } -execution::Value UpperFunction::Exec( - const std::vector& args) { +neug::Value UpperFunction::Exec(const std::vector& args) { if (args.size() != 1) { THROW_RUNTIME_ERROR("UPPER: expect exactly 1 argument, got " + std::to_string(args.size())); @@ -74,9 +73,9 @@ execution::Value UpperFunction::Exec( if (val.type().id() != DataTypeId::kVarchar) { THROW_RUNTIME_ERROR("UPPER: input value is not a string"); } - std::string str(execution::StringValue::Get(val)); + std::string str(neug::StringValue::Get(val)); std::transform(str.begin(), str.end(), str.begin(), ::toupper); - return execution::Value::STRING(str); + return neug::Value::STRING(str); } function_set LowerFunction::getFunctionSet() { @@ -87,8 +86,7 @@ function_set LowerFunction::getFunctionSet() { return functionSet; } -execution::Value LowerFunction::Exec( - const std::vector& args) { +neug::Value LowerFunction::Exec(const std::vector& args) { if (args.size() != 1) { THROW_RUNTIME_ERROR("LOWER: expect exactly 1 argument, got " + std::to_string(args.size())); @@ -97,9 +95,9 @@ execution::Value LowerFunction::Exec( if (val.type().id() != DataTypeId::kVarchar) { THROW_RUNTIME_ERROR("LOWER: input value is not a string"); } - std::string str(execution::StringValue::Get(val)); + std::string str(neug::StringValue::Get(val)); std::transform(str.begin(), str.end(), str.begin(), ::tolower); - return execution::Value::STRING(str); + return neug::Value::STRING(str); } function_set ReverseFunction::getFunctionSet() { @@ -110,8 +108,7 @@ function_set ReverseFunction::getFunctionSet() { return functionSet; } -execution::Value ReverseFunction::Exec( - const std::vector& args) { +neug::Value ReverseFunction::Exec(const std::vector& args) { if (args.size() != 1) { THROW_RUNTIME_ERROR("REVERSE: expect exactly 1 argument, got " + std::to_string(args.size())); @@ -120,9 +117,9 @@ execution::Value ReverseFunction::Exec( if (val.type().id() != DataTypeId::kVarchar) { THROW_RUNTIME_ERROR("REVERSE: input value is not a string"); } - std::string str(execution::StringValue::Get(val)); + std::string str(neug::StringValue::Get(val)); std::reverse(str.begin(), str.end()); - return execution::Value::STRING(str); + return neug::Value::STRING(str); } } // namespace function diff --git a/src/compiler/gopt/g_expr_converter.cpp b/src/compiler/gopt/g_expr_converter.cpp index 19e808220..06edff74d 100644 --- a/src/compiler/gopt/g_expr_converter.cpp +++ b/src/compiler/gopt/g_expr_converter.cpp @@ -274,7 +274,7 @@ std::unique_ptr<::common::Expression> GExprConverter::convertDefaultValue( } std::unique_ptr<::common::Expression> GExprConverter::convertValue( - const neug::common::Value& value) { + const compiler_impl::Value& value) { if (value.isNull()) { auto valuePB = std::make_unique<::common::Value>(); valuePB->set_allocated_none(new ::common::None()); @@ -328,22 +328,22 @@ std::unique_ptr<::common::Expression> GExprConverter::convertValue( switch (typeId) { case common::DataTypeId::kDate: { auto date = std::make_unique<::common::ToDate>(); - date->set_date_str( - neug::common::Date::toString(value.getValue())); + date->set_date_str(compiler_impl::Date::toString( + value.getValue())); oprPB->set_allocated_to_date(date.release()); break; } case common::DataTypeId::kTimestampMs: { auto datetime = std::make_unique<::common::ToDatetime>(); - datetime->set_datetime_str(neug::common::Timestamp::toString( - value.getValue())); + datetime->set_datetime_str(compiler_impl::Timestamp::toString( + value.getValue())); oprPB->set_allocated_to_datetime(datetime.release()); break; } case common::DataTypeId::kInterval: { auto interval = std::make_unique<::common::ToInterval>(); - interval->set_interval_str(neug::common::Interval::toString( - value.getValue())); + interval->set_interval_str(compiler_impl::Interval::toString( + value.getValue())); oprPB->set_allocated_to_interval(interval.release()); break; } @@ -434,7 +434,7 @@ std::unique_ptr<::common::Expression> GExprConverter::convertRegexFunc( auto* literalExpr = right->ptrCast(); std::string pattern = literalExpr->getValue().getValue(); std::string regexPattern = convertRegexValue(pattern, scalarType); - literalExpr->value = common::Value(regexPattern); + literalExpr->value = compiler_impl::Value(regexPattern); return convertChildren(expr, schemaAlias); } diff --git a/src/compiler/gopt/g_query_converter.cpp b/src/compiler/gopt/g_query_converter.cpp index e31eab109..980550061 100644 --- a/src/compiler/gopt/g_query_converter.cpp +++ b/src/compiler/gopt/g_query_converter.cpp @@ -546,7 +546,7 @@ ::physical::PathExpand_ResultOpt GQueryConvertor::convertResultOpt( } } -uint64_t GQueryConvertor::convertValueAsUint64(common::Value value) { +uint64_t GQueryConvertor::convertValueAsUint64(compiler_impl::Value value) { std::string valueStr = value.toString(); return std::stoull(valueStr); } diff --git a/src/compiler/main/client_context.cpp b/src/compiler/main/client_context.cpp index c6c0cd898..7f28909d9 100644 --- a/src/compiler/main/client_context.cpp +++ b/src/compiler/main/client_context.cpp @@ -88,7 +88,8 @@ ClientContext::ClientContext(MetadataManager* database) ClientContext::~ClientContext() = default; -Value ClientContext::getCurrentSetting(const std::string& optionName) const { +compiler_impl::Value ClientContext::getCurrentSetting( + const std::string& optionName) const { auto lowerCaseOptionName = optionName; StringUtils::toLower(lowerCaseOptionName); const ConfigurationOption* option = nullptr; @@ -121,7 +122,8 @@ std::unique_ptr ClientContext::tryReplace( return nullptr; } -void ClientContext::setExtensionOption(std::string name, Value value) { +void ClientContext::setExtensionOption(std::string name, + compiler_impl::Value value) { StringUtils::toLower(name); extensionOptionValues.insert_or_assign(name, std::move(value)); } @@ -204,7 +206,8 @@ std::vector> ClientContext::parseQuery( std::unique_ptr ClientContext::prepareNoLock( std::shared_ptr parsedStatement, bool shouldCommitNewTransaction, - std::optional>> + std::optional< + std::unordered_map>> inputParams) { auto preparedStatement = std::make_unique(); auto prepareTimer = TimeMetric(true /* enable */); diff --git a/src/compiler/main/settings.cpp b/src/compiler/main/settings.cpp index ea3681938..8f2a165ea 100644 --- a/src/compiler/main/settings.cpp +++ b/src/compiler/main/settings.cpp @@ -29,7 +29,7 @@ namespace neug { namespace main { void SpillToDiskSetting::setContext(ClientContext* context, - const common::Value& parameter) {} + const compiler_impl::Value& parameter) {} } // namespace main } // namespace neug diff --git a/src/compiler/optimizer/project_into_data_source_optimizer.cpp b/src/compiler/optimizer/project_into_data_source_optimizer.cpp index bc26b98ae..1eac24eb2 100644 --- a/src/compiler/optimizer/project_into_data_source_optimizer.cpp +++ b/src/compiler/optimizer/project_into_data_source_optimizer.cpp @@ -106,7 +106,7 @@ ProjectIntoDataSourceOptimizer::visitOperator( auto& options = scanBindData->fileScanInfo.options; if (visitOp->getOperatorType() != LogicalOperatorType::COPY_FROM) { options.insert_or_assign("BATCH_READ", - common::Value::createValue(false)); + compiler_impl::Value::createValue(false)); } } } diff --git a/src/compiler/parser/transform/transform_copy.cpp b/src/compiler/parser/transform/transform_copy.cpp index 083cb0872..692c9f30a 100644 --- a/src/compiler/parser/transform/transform_copy.cpp +++ b/src/compiler/parser/transform/transform_copy.cpp @@ -139,7 +139,7 @@ options_t Transformer::transformOptions( } else { // If no literal is provided, set the default value to true options.emplace(optionName, std::make_unique( - Value(true), "true")); + compiler_impl::Value(true), "true")); } } return options; diff --git a/src/compiler/parser/transform/transform_expression.cpp b/src/compiler/parser/transform/transform_expression.cpp index ad4b69e75..86db2b7c4 100644 --- a/src/compiler/parser/transform/transform_expression.cpp +++ b/src/compiler/parser/transform/transform_expression.cpp @@ -296,8 +296,8 @@ Transformer::transformUnaryAddSubtractOrFactorialExpression( neug_string_t literal{negStr.c_str(), negStr.length()}; int64_t negResult = 0; if (CastString::tryCast(literal, negResult)) { - return std::make_unique(Value(negResult), - negStr); + return std::make_unique( + compiler_impl::Value(negResult), negStr); } } for ([[maybe_unused]] auto& _ : ctx.MINUS()) { @@ -448,12 +448,12 @@ std::unique_ptr Transformer::transformLiteral( return transformBooleanLiteral(*ctx.oC_BooleanLiteral()); } else if (ctx.StringLiteral()) { return std::make_unique( - Value(DataType::Varchar(), - transformStringLiteral(*ctx.StringLiteral())), + compiler_impl::Value(DataType::Varchar(), + transformStringLiteral(*ctx.StringLiteral())), ctx.getText()); } else if (ctx.NULL_()) { - return std::make_unique(Value::createNullValue(), - ctx.getText()); + return std::make_unique( + compiler_impl::Value::createNullValue(), ctx.getText()); } else if (ctx.nEUG_StructLiteral()) { return transformStructLiteral(*ctx.nEUG_StructLiteral()); } else { @@ -465,11 +465,11 @@ std::unique_ptr Transformer::transformLiteral( std::unique_ptr Transformer::transformBooleanLiteral( CypherParser::OC_BooleanLiteralContext& ctx) { if (ctx.BTRUE()) { - return std::make_unique(Value(true), + return std::make_unique(compiler_impl::Value(true), ctx.getText()); } else if (ctx.BFALSE()) { - return std::make_unique(Value(false), - ctx.getText()); + return std::make_unique( + compiler_impl::Value(false), ctx.getText()); } NEUG_UNREACHABLE; } @@ -484,7 +484,7 @@ std::unique_ptr Transformer::transformListLiteral( listCreation->addChild(transformExpression(*ctx.oC_Expression())); for (auto& listEntry : ctx.nEUG_ListEntry()) { if (listEntry->oC_Expression() == nullptr) { - auto nullValue = Value::createNullValue(); + auto nullValue = compiler_impl::Value::createNullValue(); listCreation->addChild(std::make_unique( nullValue, nullValue.toString())); } else { @@ -547,7 +547,7 @@ std::unique_ptr Transformer::transformFunctionInvocation( } if (ctx.nEUG_DataType()) { expression->addChild(std::make_unique( - common::Value(transformDataType(*ctx.nEUG_DataType())))); + compiler_impl::Value(transformDataType(*ctx.nEUG_DataType())))); } } else { for (auto& functionParameter : ctx.nEUG_FunctionParameter()) { @@ -728,21 +728,21 @@ std::unique_ptr Transformer::transformIntegerLiteral( neug_string_t literal{text.c_str(), text.length()}; int64_t result = 0; if (function::CastString::tryCast(literal, result)) { - return std::make_unique(Value(result), - ctx.getText()); + return std::make_unique( + compiler_impl::Value(result), ctx.getText()); } // Value exceeds INT64_MAX; try uint64_t before falling back to int128_t. - // This avoids the broken Value(int128_t) constructor which sets kInt64 type - // but stores data in the int128Val union member. + // This avoids the broken compiler_impl::Value(int128_t) constructor which + // sets kInt64 type but stores data in the int128Val union member. uint64_t resultU64 = 0; if (function::CastString::tryCast(literal, resultU64)) { - return std::make_unique(Value(resultU64), - ctx.getText()); + return std::make_unique( + compiler_impl::Value(resultU64), ctx.getText()); } int128_t result128 = 0; function::CastString::operation(literal, result128); - return std::make_unique(Value(result128), - ctx.getText()); + return std::make_unique( + compiler_impl::Value(result128), ctx.getText()); } std::unique_ptr Transformer::transformDoubleLiteral( @@ -752,7 +752,7 @@ std::unique_ptr Transformer::transformDoubleLiteral( neug_string_t literal{text.c_str(), text.length()}; double result = 0; function::CastString::operation(literal, result); - return std::make_unique(Value(result), + return std::make_unique(compiler_impl::Value(result), ctx.getText()); } diff --git a/src/compiler/planner/operator/logical_dummy_scan.cpp b/src/compiler/planner/operator/logical_dummy_scan.cpp index f142c9c70..1e6427dfd 100644 --- a/src/compiler/planner/operator/logical_dummy_scan.cpp +++ b/src/compiler/planner/operator/logical_dummy_scan.cpp @@ -20,7 +20,7 @@ void LogicalDummyScan::computeFlatSchema() { std::shared_ptr LogicalDummyScan::getDummyExpression() { return std::make_shared( - Value::createNullValue(DataType::Varchar()), + compiler_impl::Value::createNullValue(DataType::Varchar()), InternalKeyword::PLACE_HOLDER); } diff --git a/src/compiler/transaction/transaction.cpp b/src/compiler/transaction/transaction.cpp index 65d6d0573..92e04a938 100644 --- a/src/compiler/transaction/transaction.cpp +++ b/src/compiler/transaction/transaction.cpp @@ -40,7 +40,7 @@ Transaction::Transaction(TransactionType transactionType) noexcept clientContext{nullptr}, forceCheckpoint{false}, hasCatalogChanges{false} { - currentTS = common::Timestamp::getCurrentTimestamp().value; + currentTS = compiler_impl::Timestamp::getCurrentTimestamp().value; } Transaction::Transaction(TransactionType transactionType, @@ -53,7 +53,7 @@ Transaction::Transaction(TransactionType transactionType, clientContext{nullptr}, forceCheckpoint{false}, hasCatalogChanges{false} { - currentTS = common::Timestamp::getCurrentTimestamp().value; + currentTS = compiler_impl::Timestamp::getCurrentTimestamp().value; } void Transaction::commit(storage::WAL* wal) {} diff --git a/src/execution/common/operators/insert/create_edge.cc b/src/execution/common/operators/insert/create_edge.cc index 94cd0a759..bcce60c26 100644 --- a/src/execution/common/operators/insert/create_edge.cc +++ b/src/execution/common/operators/insert/create_edge.cc @@ -14,11 +14,10 @@ */ #include "neug/execution/common/operators/insert/create_edge.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/execution/common/context_chunk.h" -#include "neug/execution/common/data_chunk.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" @@ -71,7 +70,7 @@ neug::result CreateEdge::insert_edge( std::to_string(dst_label) + ", got " + std::to_string(v2.label_)); } - std::vector property_values(properties.size()); + std::vector property_values(properties.size()); for (size_t j = 0; j < properties.size(); ++j) { const auto& [prop_name, prop_expr] = properties[j]; Value value = diff --git a/src/execution/common/operators/insert/create_vertex.cc b/src/execution/common/operators/insert/create_vertex.cc index f2654ab44..bee6a8b1a 100644 --- a/src/execution/common/operators/insert/create_vertex.cc +++ b/src/execution/common/operators/insert/create_vertex.cc @@ -14,10 +14,9 @@ */ #include "neug/execution/common/operators/insert/create_vertex.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/execution/common/context_chunk.h" -#include "neug/execution/common/data_chunk.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/expression/expr.h" #include "neug/storages/graph/graph_interface.h" namespace neug { @@ -60,7 +59,7 @@ neug::result CreateVertex::insert_vertex( } Value pk_value; - std::vector property_values(properties.size() - 1); + std::vector property_values(properties.size() - 1); // When the chunk has no rows (seed from DummySourceOpr), we still need to // execute exactly once to create the vertex from constant expressions. size_t num_rows = std::max(chunk.row_num(), (size_t) 1); diff --git a/src/execution/common/operators/retrieve/dedup.cc b/src/execution/common/operators/retrieve/dedup.cc index d3440f0b5..b212991e7 100644 --- a/src/execution/common/operators/retrieve/dedup.cc +++ b/src/execution/common/operators/retrieve/dedup.cc @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" #include "neug/utils/encoder.h" namespace neug { diff --git a/src/execution/common/operators/retrieve/edge_expand.cc b/src/execution/common/operators/retrieve/edge_expand.cc index e23925d5a..5ba1c4c8d 100644 --- a/src/execution/common/operators/retrieve/edge_expand.cc +++ b/src/execution/common/operators/retrieve/edge_expand.cc @@ -15,7 +15,7 @@ #include "neug/execution/common/operators/retrieve/edge_expand.h" -#include "neug/execution/common/columns/value_columns.h" +#include "neug/common/columns/value_columns.h" #include "neug/execution/common/operators/retrieve/edge_expand_impl.h" #include "neug/execution/expression/predicates.h" #include "neug/execution/utils/opr_timer.h" diff --git a/src/execution/common/operators/retrieve/intersect.cc b/src/execution/common/operators/retrieve/intersect.cc index f4482ff53..b6daec6ec 100644 --- a/src/execution/common/operators/retrieve/intersect.cc +++ b/src/execution/common/operators/retrieve/intersect.cc @@ -15,10 +15,10 @@ #include "neug/execution/common/operators/retrieve/intersect.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/execution/common/context_chunk.h" -#include "neug/execution/common/data_chunk.h" #include "neug/execution/utils/params.h" #include "neug/storages/graph/graph_interface.h" diff --git a/src/execution/common/operators/retrieve/join.cc b/src/execution/common/operators/retrieve/join.cc index c0acfde47..fed615477 100644 --- a/src/execution/common/operators/retrieve/join.cc +++ b/src/execution/common/operators/retrieve/join.cc @@ -15,10 +15,10 @@ #include "neug/execution/common/operators/retrieve/join.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/common/types.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/execution/common/context_chunk.h" -#include "neug/execution/common/data_chunk.h" #include "neug/execution/utils/params.h" #include "neug/storages/graph/graph_interface.h" #include "neug/utils/encoder.h" diff --git a/src/execution/common/operators/retrieve/path_expand.cc b/src/execution/common/operators/retrieve/path_expand.cc index dce19dc11..895d7df76 100644 --- a/src/execution/common/operators/retrieve/path_expand.cc +++ b/src/execution/common/operators/retrieve/path_expand.cc @@ -15,7 +15,7 @@ #include "neug/execution/common/operators/retrieve/path_expand.h" -#include "neug/execution/common/columns/path_columns.h" +#include "neug/common/columns/path_columns.h" #include "neug/execution/common/operators/retrieve/path_expand_impl.h" #include "neug/execution/expression/special_predicates.h" diff --git a/src/execution/common/operators/retrieve/sink.cc b/src/execution/common/operators/retrieve/sink.cc index 3ea7073c8..edf133f33 100644 --- a/src/execution/common/operators/retrieve/sink.cc +++ b/src/execution/common/operators/retrieve/sink.cc @@ -15,15 +15,15 @@ #include "neug/execution/common/operators/retrieve/sink.h" -#include "neug/execution/common/columns/array_columns.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/list_columns.h" -#include "neug/execution/common/columns/path_columns.h" -#include "neug/execution/common/columns/struct_columns.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/columns/path_columns.h" +#include "neug/common/columns/struct_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/array_columns.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/graph/graph_interface.h" diff --git a/src/execution/common/operators/retrieve/unfold.cc b/src/execution/common/operators/retrieve/unfold.cc index e8bde7fa7..591df18ed 100644 --- a/src/execution/common/operators/retrieve/unfold.cc +++ b/src/execution/common/operators/retrieve/unfold.cc @@ -15,9 +15,9 @@ #include "neug/execution/common/operators/retrieve/unfold.h" -#include "neug/execution/common/columns/array_columns.h" -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/columns/list_columns.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/types/array_columns.h" #include "neug/execution/expression/expr.h" #include "neug/utils/exception/exception.h" #include "neug/utils/result.h" diff --git a/src/execution/execute/ops/batch/batch_delete_edge.cc b/src/execution/execute/ops/batch/batch_delete_edge.cc index 87fe5118f..6555f65f1 100644 --- a/src/execution/execute/ops/batch/batch_delete_edge.cc +++ b/src/execution/execute/ops/batch/batch_delete_edge.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/execute/ops/batch/batch_delete_edge.h" -#include "neug/execution/common/columns/edge_columns.h" +#include "neug/common/columns/edge_columns.h" #include "neug/storages/csr/csr_view_utils.h" #include diff --git a/src/execution/execute/ops/batch/batch_delete_vertex.cc b/src/execution/execute/ops/batch/batch_delete_vertex.cc index cf0131580..7dde5d640 100644 --- a/src/execution/execute/ops/batch/batch_delete_vertex.cc +++ b/src/execution/execute/ops/batch/batch_delete_vertex.cc @@ -14,8 +14,8 @@ */ #include "neug/execution/execute/ops/batch/batch_delete_vertex.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/vertex_columns.h" namespace neug { namespace execution { diff --git a/src/execution/execute/ops/batch/batch_update_edge.cc b/src/execution/execute/ops/batch/batch_update_edge.cc index fe7d86760..4ed973831 100644 --- a/src/execution/execute/ops/batch/batch_update_edge.cc +++ b/src/execution/execute/ops/batch/batch_update_edge.cc @@ -14,8 +14,7 @@ */ #include "neug/execution/execute/ops/batch/batch_update_edge.h" -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/columns/edge_columns.h" #include "neug/execution/expression/expr.h" #include "neug/storages/csr/csr_view_utils.h" #include "neug/utils/pb_utils.h" diff --git a/src/execution/execute/ops/batch/batch_update_utils.cc b/src/execution/execute/ops/batch/batch_update_utils.cc index c35d59d7e..4339f2947 100644 --- a/src/execution/execute/ops/batch/batch_update_utils.cc +++ b/src/execution/execute/ops/batch/batch_update_utils.cc @@ -28,9 +28,9 @@ #include #include "neug/utils/exception/exception.h" -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/graph/graph_interface.h" #include "neug/storages/loader/loader_utils.h" #include "neug/utils/string_utils.h" @@ -64,7 +64,7 @@ bool check_csv_import_options( void add_member(rapidjson::Value& object, rapidjson::Document::AllocatorType& allocator, - const std::string& key, const execution::Value& value) { + const std::string& key, const Value& value) { if (value.type().id() == DataTypeId::kBoolean) { object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), value.GetValue(), allocator); @@ -87,25 +87,23 @@ void add_member(rapidjson::Value& object, object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), value.GetValue(), allocator); } else if (value.type().id() == DataTypeId::kDate) { - std::string date = value.GetValue().to_string(); + std::string date = value.GetValue().to_string(); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), rapidjson::Value(date.c_str(), allocator).Move(), allocator); } else if (value.type().id() == DataTypeId::kTimestampMs) { - std::string date_time = - value.GetValue().to_string(); + std::string date_time = value.GetValue().to_string(); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), rapidjson::Value(date_time.c_str(), allocator).Move(), allocator); } else if (value.type().id() == DataTypeId::kVarchar) { rapidjson::Value valueVal; - const std::string& str_value = execution::StringValue::Get(value); + const std::string& str_value = StringValue::Get(value); valueVal.SetString(str_value.data(), str_value.size(), allocator); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), valueVal, allocator); } else if (value.type().id() == DataTypeId::kInterval) { - std::string interval_str = - value.GetValue().to_string(); + std::string interval_str = value.GetValue().to_string(); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), rapidjson::Value(interval_str.c_str(), allocator).Move(), allocator); @@ -116,7 +114,7 @@ void add_member(rapidjson::Value& object, void add_prop_member(rapidjson::Value& object, rapidjson::Document::AllocatorType& allocator, - const std::string& key, const execution::Value& value) { + const std::string& key, const Value& value) { if (value.type().id() == DataTypeId::kInt32) { object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), value.GetValue(), allocator); @@ -136,23 +134,21 @@ void add_prop_member(rapidjson::Value& object, object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), value.GetValue(), allocator); } else if (value.type().id() == DataTypeId::kDate) { - std::string date = value.GetValue().to_string(); + std::string date = value.GetValue().to_string(); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), rapidjson::Value(date.c_str(), allocator).Move(), allocator); } else if (value.type().id() == DataTypeId::kTimestampMs) { object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), - value.GetValue().milli_second, - allocator); + value.GetValue().milli_second, allocator); } else if (value.type().id() == DataTypeId::kInterval) { - std::string interval_str = - value.GetValue().to_string(); + std::string interval_str = value.GetValue().to_string(); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), rapidjson::Value(interval_str.c_str(), allocator).Move(), allocator); } else if (value.type().id() == DataTypeId::kVarchar) { rapidjson::Value valueVal; - const std::string& str_value = execution::StringValue::Get(value); + const std::string& str_value = StringValue::Get(value); valueVal.SetString(str_value.data(), str_value.size(), allocator); object.AddMember(rapidjson::Value(key.c_str(), allocator).Move(), valueVal, allocator); @@ -169,11 +165,11 @@ rapidjson::Value build_vertex_object( std::string internal_id_key = "_ID"; std::string encoded_id_str = std::to_string(label) + ":" + std::to_string(vid); - execution::Value encoded_id = execution::Value::STRING(encoded_id_str); + Value encoded_id = Value::STRING(encoded_id_str); add_member(vertex_object, allocator, internal_id_key, encoded_id); std::string internal_label_key = "_LABEL"; std::string label_name_str = graph.schema().get_vertex_label_name(label); - execution::Value label_name = execution::Value::STRING(label_name_str); + Value label_name = Value::STRING(label_name_str); add_member(vertex_object, allocator, internal_label_key, label_name); std::string primary_key = graph.schema().get_vertex_primary_key_name(label); add_member(vertex_object, allocator, primary_key, @@ -209,30 +205,28 @@ rapidjson::Value build_edge_object( std::string internal_src_id = "_SRC"; std::string encoded_src_id_str = std::to_string(src_label) + ":" + std::to_string(edge.src); - execution::Value encoded_src_id = - execution::Value::STRING(encoded_src_id_str); + Value encoded_src_id = Value::STRING(encoded_src_id_str); add_member(edge_object, allocator, internal_src_id, encoded_src_id); std::string internal_dst_id = "_DST"; std::string encoded_dst_id_str = std::to_string(dst_label) + ":" + std::to_string(edge.dst); - execution::Value encoded_dst_id = - execution::Value::STRING(encoded_dst_id_str); + Value encoded_dst_id = Value::STRING(encoded_dst_id_str); add_member(edge_object, allocator, internal_dst_id, encoded_dst_id); std::string internal_src_label_key = "_SRC_LABEL"; - execution::Value src_label_name = - execution::Value::STRING(graph.schema().get_vertex_label_name(src_label)); + Value src_label_name = + Value::STRING(graph.schema().get_vertex_label_name(src_label)); add_member(edge_object, allocator, internal_src_label_key, src_label_name); std::string internal_dst_label_key = "_DST_LABEL"; - execution::Value dst_label_name = - execution::Value::STRING(graph.schema().get_vertex_label_name(dst_label)); + Value dst_label_name = + Value::STRING(graph.schema().get_vertex_label_name(dst_label)); add_member(edge_object, allocator, internal_dst_label_key, dst_label_name); std::string internal_label_key = "_LABEL"; - execution::Value edge_label_name = - execution::Value::STRING(graph.schema().get_edge_label_name(edge_label)); + Value edge_label_name = + Value::STRING(graph.schema().get_edge_label_name(edge_label)); add_member(edge_object, allocator, internal_label_key, edge_label_name); auto property_names = @@ -273,19 +267,18 @@ std::string path_to_json_string(Path& path, const StorageReadInterface& graph) { if (i > 0) { rapidjson::Value edge_object(rapidjson::kObjectType); std::string internal_src_label_key = "_SRC_LABEL"; - execution::Value src_label_name = execution::Value::STRING( + Value src_label_name = Value::STRING( graph.schema().get_vertex_label_name(path_vertices[i - 1].label_)); add_member(edge_object, allocator, internal_src_label_key, src_label_name); std::string internal_dst_label_key = "_DST_LABEL"; - execution::Value dst_label_name = execution::Value::STRING( + Value dst_label_name = Value::STRING( graph.schema().get_vertex_label_name(path_vertices[i].label_)); add_member(edge_object, allocator, internal_dst_label_key, dst_label_name); std::string internal_label_key = "_LABEL"; - execution::Value edge_label_name = - execution::Value::STRING(graph.schema().get_edge_label_name( - path_edges[i - 1].label.edge_label)); + Value edge_label_name = Value::STRING(graph.schema().get_edge_label_name( + path_edges[i - 1].label.edge_label)); add_member(edge_object, allocator, internal_label_key, edge_label_name); edge_array.PushBack(edge_object, allocator); } diff --git a/src/execution/execute/ops/batch/batch_update_vertex.cc b/src/execution/execute/ops/batch/batch_update_vertex.cc index 758e39ef7..959035448 100644 --- a/src/execution/execute/ops/batch/batch_update_vertex.cc +++ b/src/execution/execute/ops/batch/batch_update_vertex.cc @@ -14,8 +14,7 @@ */ #include "neug/execution/execute/ops/batch/batch_update_vertex.h" -#include "neug/execution/common/columns/vertex_columns.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/expr.h" #include "neug/utils/pb_utils.h" diff --git a/src/execution/execute/ops/ddl/add_edge_property.cc b/src/execution/execute/ops/ddl/add_edge_property.cc index f124593a2..a0a0ca1c8 100644 --- a/src/execution/execute/ops/ddl/add_edge_property.cc +++ b/src/execution/execute/ops/ddl/add_edge_property.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/execute/ops/ddl/add_edge_property.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/pb_utils.h" namespace neug { diff --git a/src/execution/execute/ops/ddl/add_vertex_property.cc b/src/execution/execute/ops/ddl/add_vertex_property.cc index 2c3df33b5..5b224bca4 100644 --- a/src/execution/execute/ops/ddl/add_vertex_property.cc +++ b/src/execution/execute/ops/ddl/add_vertex_property.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/execute/ops/ddl/add_vertex_property.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/pb_utils.h" namespace neug { diff --git a/src/execution/execute/ops/ddl/create_edge_type.cc b/src/execution/execute/ops/ddl/create_edge_type.cc index 571f90d20..49a9557e6 100644 --- a/src/execution/execute/ops/ddl/create_edge_type.cc +++ b/src/execution/execute/ops/ddl/create_edge_type.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/execute/ops/ddl/create_edge_type.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/pb_utils.h" namespace neug { diff --git a/src/execution/execute/ops/ddl/create_vertex_type.cc b/src/execution/execute/ops/ddl/create_vertex_type.cc index 2236e0d0e..bacb1ef6a 100644 --- a/src/execution/execute/ops/ddl/create_vertex_type.cc +++ b/src/execution/execute/ops/ddl/create_vertex_type.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/execute/ops/ddl/create_vertex_type.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/pb_utils.h" namespace neug { diff --git a/src/execution/execute/ops/insert/merge_edge.cc b/src/execution/execute/ops/insert/merge_edge.cc index feac37c80..31dd6c779 100644 --- a/src/execution/execute/ops/insert/merge_edge.cc +++ b/src/execution/execute/ops/insert/merge_edge.cc @@ -21,11 +21,11 @@ #include #include -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/graph_types.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/types/graph_types.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/expression/expr.h" #include "neug/generated/proto/plan/cypher_dml.pb.h" #include "neug/storages/csr/csr_view_utils.h" @@ -158,7 +158,7 @@ EdgeRecord insert_and_return_edge_row( std::to_string(dst_label) + ", got " + std::to_string(v2.label_)); } - std::vector property_values(properties.size()); + std::vector property_values(properties.size()); for (size_t j = 0; j < properties.size(); ++j) { const auto& [prop_name, prop_expr] = properties[j]; Value value = prop_expr->Cast().eval_record(chunk, row); diff --git a/src/execution/execute/ops/insert/merge_vertex.cc b/src/execution/execute/ops/insert/merge_vertex.cc index 7f901c1fb..025d1691d 100644 --- a/src/execution/execute/ops/insert/merge_vertex.cc +++ b/src/execution/execute/ops/insert/merge_vertex.cc @@ -21,9 +21,9 @@ #include #include -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/types/value.h" #include "neug/execution/expression/expr.h" #include "neug/generated/proto/plan/cypher_dml.pb.h" #include "neug/storages/graph/graph_interface.h" @@ -132,7 +132,7 @@ neug::result insert_vertex_row( } Value pk_value; - std::vector property_values(properties.size() - 1); + std::vector property_values(properties.size() - 1); for (size_t j = 0; j < properties.size(); ++j) { const auto& [prop_name, prop_expr] = properties[j]; Value value = prop_expr->Cast().eval_record(chunk, row); diff --git a/src/execution/execute/ops/retrieve/group_by_utils.cc b/src/execution/execute/ops/retrieve/group_by_utils.cc index ddb2535bd..9378dbaf6 100644 --- a/src/execution/execute/ops/retrieve/group_by_utils.cc +++ b/src/execution/execute/ops/retrieve/group_by_utils.cc @@ -14,10 +14,9 @@ */ #include "neug/execution/execute/ops/retrieve/group_by_utils.h" -#include "neug/execution/common/columns/i_context_column.h" -#include "neug/execution/common/columns/list_columns.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/utils/exception/exception.h" namespace neug { diff --git a/src/execution/execute/ops/retrieve/join.cc b/src/execution/execute/ops/retrieve/join.cc index a21edbac8..d2540ce14 100644 --- a/src/execution/execute/ops/retrieve/join.cc +++ b/src/execution/execute/ops/retrieve/join.cc @@ -17,9 +17,9 @@ #include +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/execution/common/operators/retrieve/join.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/execution/execute/pipeline.h" #include "neug/execution/execute/plan_parser.h" #include "neug/execution/utils/params.h" diff --git a/src/execution/execute/ops/retrieve/order_by_utils.cc b/src/execution/execute/ops/retrieve/order_by_utils.cc index 564ffab61..4becda8d2 100644 --- a/src/execution/execute/ops/retrieve/order_by_utils.cc +++ b/src/execution/execute/ops/retrieve/order_by_utils.cc @@ -15,7 +15,7 @@ #include "neug/execution/execute/ops/retrieve/order_by_utils.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/storages/graph/graph_interface.h" namespace neug { namespace execution { diff --git a/src/execution/execute/ops/retrieve/path.cc b/src/execution/execute/ops/retrieve/path.cc index 1c2c6c765..1ba2fefdb 100644 --- a/src/execution/execute/ops/retrieve/path.cc +++ b/src/execution/execute/ops/retrieve/path.cc @@ -15,8 +15,8 @@ #include "neug/execution/execute/ops/retrieve/path.h" +#include "neug/common/types/value.h" #include "neug/execution/common/operators/retrieve/path_expand.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/execution/expression/predicates.h" #include "neug/execution/utils/pb_parse_utils.h" @@ -467,14 +467,14 @@ class ASPOpr : public IOperator { neug::execution::OprTimer* timer) override { const auto& graph = dynamic_cast(graph_interface); - execution::Value oid; + Value oid; if (expr_opr_.has_param()) { auto name = expr_opr_.param().name(); auto val = params.at(name).GetValue(); - oid = execution::Value::INT64(val); + oid = Value::INT64(val); } else { const auto& c = expr_opr_.const_(); - oid = execution::Value::INT64(c.i64()); + oid = Value::INT64(c.i64()); } vid_t vid; if (!graph.GetVertexIndex(aspp_.labels[0].dst_label, oid, vid)) { @@ -512,14 +512,14 @@ class SSSDSPOpr : public IOperator { neug::execution::OprTimer* timer) override { const auto& graph = dynamic_cast(graph_interface); - execution::Value vertex = [&]() { + Value vertex = [&]() { if (expr_opr_.has_param()) { auto name = expr_opr_.param().name(); auto val = params.at(name).GetValue(); - return execution::Value::INT64(val); + return Value::INT64(val); } else { const auto& c = expr_opr_.const_(); - return execution::Value::INT64(c.i64()); + return Value::INT64(c.i64()); } }(); vid_t vid; diff --git a/src/execution/execute/ops/retrieve/scan.cc b/src/execution/execute/ops/retrieve/scan.cc index 16033f1ff..dbd6924e7 100644 --- a/src/execution/execute/ops/retrieve/scan.cc +++ b/src/execution/execute/ops/retrieve/scan.cc @@ -15,8 +15,8 @@ #include "neug/execution/execute/ops/retrieve/scan.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/common/operators/retrieve/scan.h" #include "neug/execution/execute/ops/retrieve/scan_utils.h" #include "neug/execution/expression/predicates.h" diff --git a/src/execution/execute/ops/retrieve/scan_utils.cc b/src/execution/execute/ops/retrieve/scan_utils.cc index d937ebbff..395819a85 100644 --- a/src/execution/execute/ops/retrieve/scan_utils.cc +++ b/src/execution/execute/ops/retrieve/scan_utils.cc @@ -16,7 +16,7 @@ */ #include "neug/execution/execute/ops/retrieve/scan_utils.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/utils/pb_parse_utils.h" #include "neug/utils/exception/exception.h" diff --git a/src/execution/execute/ops/retrieve/select.cc b/src/execution/execute/ops/retrieve/select.cc index a8830235d..200d9e5a8 100644 --- a/src/execution/execute/ops/retrieve/select.cc +++ b/src/execution/execute/ops/retrieve/select.cc @@ -20,7 +20,7 @@ #include "neug/storages/graph/graph_interface.h" #include "neug/utils/property/types.h" -#include "neug/execution/common/columns/vertex_columns.h" +#include "neug/common/columns/vertex_columns.h" #include "neug/execution/expression/predicates.h" namespace neug { @@ -52,41 +52,39 @@ class SelectIdNeOpr : public IOperator { ? params.at(param_name_).GetValue() : 0; - return ctx.apply_chunks( - [&](ContextChunk&& chunk) -> neug::result { - auto col = chunk.get(tag_); - if ((!col->is_optional()) && - col->column_type() == ContextColumnType::kVertex) { - auto vertex_col = std::dynamic_pointer_cast(col); - auto labels = vertex_col->get_labels_set(); - if (labels.size() == 1 && - name == graph_interface.schema().get_vertex_primary_key_name( - *labels.begin())) { - auto label = *labels.begin(); - vid_t vid; - if (graph_interface.GetVertexIndex( - label, execution::Value::INT64(oid), vid)) { - if (vertex_col->vertex_column_type() == - VertexColumnType::kSingle) { - const SLVertexColumn& sl_vertex_col = - *(dynamic_cast(vertex_col.get())); - return Select::select( - std::move(chunk), - [&sl_vertex_col, vid](const DataChunk&, size_t i) { - return sl_vertex_col.get_vertex(i).vid_ != vid; - }); - } else { - return Select::select( - std::move(chunk), - [&vertex_col, vid](const DataChunk&, size_t i) { - return vertex_col->get_vertex(i).vid_ != vid; - }); - } - } + return ctx.apply_chunks([&](ContextChunk&& chunk) + -> neug::result { + auto col = chunk.get(tag_); + if ((!col->is_optional()) && + col->column_type() == ContextColumnType::kVertex) { + auto vertex_col = std::dynamic_pointer_cast(col); + auto labels = vertex_col->get_labels_set(); + if (labels.size() == 1 && + name == graph_interface.schema().get_vertex_primary_key_name( + *labels.begin())) { + auto label = *labels.begin(); + vid_t vid; + if (graph_interface.GetVertexIndex(label, Value::INT64(oid), vid)) { + if (vertex_col->vertex_column_type() == VertexColumnType::kSingle) { + const SLVertexColumn& sl_vertex_col = + *(dynamic_cast(vertex_col.get())); + return Select::select( + std::move(chunk), + [&sl_vertex_col, vid](const DataChunk&, size_t i) { + return sl_vertex_col.get_vertex(i).vid_ != vid; + }); + } else { + return Select::select( + std::move(chunk), + [&vertex_col, vid](const DataChunk&, size_t i) { + return vertex_col->get_vertex(i).vid_ != vid; + }); } } - return Select::select(std::move(chunk), fallback_pred); - }); + } + } + return Select::select(std::move(chunk), fallback_pred); + }); } private: diff --git a/src/execution/execute/ops/retrieve/tc_fuse.cc b/src/execution/execute/ops/retrieve/tc_fuse.cc index df31cd38b..fd1cb6be6 100644 --- a/src/execution/execute/ops/retrieve/tc_fuse.cc +++ b/src/execution/execute/ops/retrieve/tc_fuse.cc @@ -13,9 +13,9 @@ * limitations under the License. */ +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/execution/common/operators/retrieve/edge_expand.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/execution/execute/operator.h" #include "neug/execution/execute/ops/retrieve/edge.h" #include "neug/execution/expression/special_predicates.h" diff --git a/src/execution/execute/ops/retrieve/vertex.cc b/src/execution/execute/ops/retrieve/vertex.cc index a0c8335ce..a763fa7b1 100644 --- a/src/execution/execute/ops/retrieve/vertex.cc +++ b/src/execution/execute/ops/retrieve/vertex.cc @@ -15,9 +15,9 @@ #include "neug/execution/execute/ops/retrieve/vertex.h" +#include "neug/common/types/graph_types.h" #include "neug/execution/common/context.h" #include "neug/execution/common/operators/retrieve/get_v.h" -#include "neug/execution/common/types/graph_types.h" #include "neug/execution/expression/expr.h" #include "neug/execution/utils/params.h" #include "neug/execution/utils/pb_parse_utils.h" diff --git a/src/execution/expression/accessors/record_accessor.cc b/src/execution/expression/accessors/record_accessor.cc index 282feadf4..bf9a6ccce 100644 --- a/src/execution/expression/accessors/record_accessor.cc +++ b/src/execution/expression/accessors/record_accessor.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/expression/accessors/record_accessor.h" -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" #include "neug/utils/exception/exception.h" namespace neug { diff --git a/src/execution/expression/exprs/path_expr.cc b/src/execution/expression/exprs/path_expr.cc index 37c3cf172..7b9c67930 100644 --- a/src/execution/expression/exprs/path_expr.cc +++ b/src/execution/expression/exprs/path_expr.cc @@ -14,7 +14,7 @@ */ #include "neug/execution/expression/exprs/path_expr.h" -#include "neug/execution/common/columns/i_context_column.h" +#include "neug/common/types/i_context_column.h" #include "neug/execution/common/context.h" namespace neug { diff --git a/src/main/query_processor.cc b/src/main/query_processor.cc index a2b26e9c0..867eb9812 100644 --- a/src/main/query_processor.cc +++ b/src/main/query_processor.cc @@ -96,8 +96,7 @@ result QueryProcessor::execute(const std::string& query_string, RETURN_ERROR(neug::Status(neug::StatusCode::ERR_INVALID_ARGUMENT, "Unexpected parameter: " + key)); } - params_map.emplace( - key, execution::Value::FromJson(member.value, iter->second)); + params_map.emplace(key, Value::FromJson(member.value, iter->second)); } } if (need_exclusive_lock(access_mode_pipeline.first)) { diff --git a/src/main/query_request.cc b/src/main/query_request.cc index b9b83cbe0..1bef5076a 100644 --- a/src/main/query_request.cc +++ b/src/main/query_request.cc @@ -17,7 +17,7 @@ #include "neug/utils/serialization/in_archive.h" #include "neug/utils/serialization/out_archive.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "rapidjson/document.h" #include "rapidjson/rapidjson.h" #include "rapidjson/stringbuffer.h" @@ -38,8 +38,7 @@ execution::ParamsMap ParamsParser::ParseFromJsonObj( if (meta.count(key) <= 0) { VLOG(1) << "Parameter key not found in meta: " << key; } else { - param_map.emplace(key, - execution::Value::FromJson(itr->value, meta.at(key))); + param_map.emplace(key, Value::FromJson(itr->value, meta.at(key))); } } return param_map; @@ -89,7 +88,7 @@ std::string RequestSerializer::SerializeRequest( for (const auto& kv : parameters) { parameter_obj.AddMember( rapidjson::Value(kv.first.c_str(), kv.first.size(), allocator), - execution::Value::ToJson(kv.second, allocator), allocator); + Value::ToJson(kv.second, allocator), allocator); } document.AddMember("parameters", parameter_obj, allocator); rapidjson::StringBuffer buffer; diff --git a/src/storages/csr/csr_view_utils.cc b/src/storages/csr/csr_view_utils.cc index 298984b1b..5d52ba844 100644 --- a/src/storages/csr/csr_view_utils.cc +++ b/src/storages/csr/csr_view_utils.cc @@ -14,7 +14,7 @@ */ #include "neug/storages/csr/csr_view_utils.h" -#include "neug/execution/common/types/graph_types.h" +#include "neug/common/types/graph_types.h" #include "neug/utils/property/types.h" namespace neug { @@ -134,12 +134,11 @@ size_t get_offset_for_edge_record(const NbrList& nbr_list, vid_t expected_nbr, } std::pair record_to_csr_offset_pair( - const CsrView& oe, const CsrView& ie, - const neug::execution::EdgeRecord& record, + const CsrView& oe, const CsrView& ie, const EdgeRecord& record, const std::vector& props) { NbrList cur_nbr_list, another_nbr_list; vid_t src, nbr; - if (record.dir == execution::Direction::kOut) { + if (record.dir == Direction::kOut) { cur_nbr_list = oe.get_edges(record.src); another_nbr_list = ie.get_edges(record.dst); src = record.src; @@ -160,7 +159,7 @@ std::pair record_to_csr_offset_pair( another_offset = neug::fuzzy_search_offset_from_nbr_list( another_nbr_list, src, record.prop, e_prop_type); assert(another_offset != std::numeric_limits::max()); - if (record.dir == execution::Direction::kOut) { + if (record.dir == Direction::kOut) { return std::make_pair(cur_offset, another_offset); } else { return std::make_pair(another_offset, cur_offset); diff --git a/src/storages/graph/edge_table.cc b/src/storages/graph/edge_table.cc index fa16fdb11..111b74f42 100644 --- a/src/storages/graph/edge_table.cc +++ b/src/storages/graph/edge_table.cc @@ -75,7 +75,7 @@ void batch_put_edges_with_default_edata_impl(const std::vector& src_lid, void batch_put_edges_with_default_edata(const std::vector& src_lid, const std::vector& dst_lid, DataTypeId property_type, - const execution::Value& default_value, + const Value& default_value, CsrBase* out_csr) { assert(src_lid.size() == dst_lid.size()); switch (property_type) { @@ -96,10 +96,11 @@ void batch_put_edges_with_default_edata(const std::vector& src_lid, } } -void batch_put_edges_to_bundled_csr( - const std::vector& src_lid, const std::vector& dst_lid, - DataTypeId property_type, const std::vector& edge_data, - CsrBase* out_csr) { +void batch_put_edges_to_bundled_csr(const std::vector& src_lid, + const std::vector& dst_lid, + DataTypeId property_type, + const std::vector& edge_data, + CsrBase* out_csr) { switch (property_type) { #define TYPE_DISPATCHER(enum_val, type) \ case DataTypeId::enum_val: { \ @@ -180,10 +181,9 @@ static std::unique_ptr create_csr(bool is_mutable, } } -static void parse_endpoint_column( - const IndexerType& indexer, - const std::shared_ptr& col, - std::vector& lids) { +static void parse_endpoint_column(const IndexerType& indexer, + const std::shared_ptr& col, + std::vector& lids) { for (size_t i = 0; i < col->size(); ++i) { auto val = col->get_elem(i); auto vid = indexer.get_index(val); @@ -204,7 +204,7 @@ template void insert_edges_bundled_typed_impl( TypedCsrBase* out_csr, TypedCsrBase* in_csr, const std::vector& src_lid, const std::vector& dst_lid, - const std::vector>& data_cols, + const std::vector>& data_cols, const std::vector& valid_flags) { std::vector edge_data; edge_data.reserve(src_lid.size()); @@ -234,10 +234,10 @@ void insert_edges_separated_impl(TypedCsrBase* out_csr, in_csr->batch_put_edges(dst_lid, src_lid, edge_data); } -static std::vector get_row_from_data_chunks( - const std::vector>& prop_cols, +static std::vector get_row_from_data_chunks( + const std::vector>& prop_cols, size_t row_idx) { - std::vector row; + std::vector row; row.reserve(prop_cols.size()); for (auto& col : prop_cols) { row.push_back(col->get_elem(row_idx)); @@ -251,7 +251,7 @@ void batch_add_unbundled_edges_impl( TypedCsrBase* in_csr, Table* table_, std::atomic& table_idx_, std::atomic& capacity_, const std::vector& prop_types, - const std::vector>& data_chunks, + const std::vector>& data_chunks, const std::vector& valid_flags) { size_t offset = table_idx_.fetch_add(src_lid_list.size()); insert_edges_separated_impl(out_csr, in_csr, src_lid_list, dst_lid_list, @@ -260,7 +260,7 @@ void batch_add_unbundled_edges_impl( for (auto& chunk : data_chunks) { size_t num_rows = chunk->row_num(); // Build per-column accessors for this chunk. - std::vector> prop_cols; + std::vector> prop_cols; prop_cols.reserve(chunk->col_num()); for (auto& c : chunk->columns) { if (c) @@ -280,7 +280,7 @@ void batch_add_bundled_edges_impl( CsrBase* out_csr, CsrBase* in_csr, std::shared_ptr meta, const std::vector& src_lid_list, const std::vector& dst_lid_list, - const std::vector>& data_cols, + const std::vector>& data_cols, const std::vector& valid_flags) { const auto& prop_types = meta->properties; if (prop_types.empty() || prop_types[0].id() == DataTypeId::kEmpty) { @@ -533,7 +533,7 @@ void EdgeTable::DeleteVertex(bool is_src, vid_t vid, timestamp_t ts) { void EdgeTable::UpdateEdgeProperty(vid_t src_lid, vid_t dst_lid, int32_t oe_offset, int32_t ie_offset, - int32_t col_id, const execution::Value& prop, + int32_t col_id, const Value& prop, timestamp_t ts) { auto accessor = get_edge_data_accessor(col_id); auto oe_edges = out_csr_->get_generic_view(ts).get_edges(src_lid); @@ -628,10 +628,10 @@ EdgeDataAccessor EdgeTable::get_edge_data_accessor( return get_edge_data_accessor(static_cast(prop_ind)); } -void EdgeTable::AddProperties( - Checkpoint& ckp, const std::vector& prop_names, - const std::vector& prop_types, - const std::vector& default_values) { +void EdgeTable::AddProperties(Checkpoint& ckp, + const std::vector& prop_names, + const std::vector& prop_types, + const std::vector& default_values) { if (prop_names.empty()) { return; } @@ -695,9 +695,8 @@ void EdgeTable::DeleteProperties(Checkpoint& ckp, } std::pair EdgeTable::AddEdge( - vid_t src_lid, vid_t dst_lid, - const std::vector& edge_data, timestamp_t ts, - Allocator& alloc, bool insert_safe) { + vid_t src_lid, vid_t dst_lid, const std::vector& edge_data, + timestamp_t ts, Allocator& alloc, bool insert_safe) { return internal::insert_edge_into_csr_internal( *out_csr_, *in_csr_, *table_.get(), table_idx_, *meta_, src_lid, dst_lid, edge_data, ts, alloc, insert_safe); @@ -711,8 +710,8 @@ void EdgeTable::BatchAddEdges(const IndexerType& src_indexer, std::vector src_lid, dst_lid; // Collect per-property columns across chunks (for bundled: single column; // for unbundled: full property DataChunks). - std::vector> bundled_data_cols; - std::vector> unbundled_data_chunks; + std::vector> bundled_data_cols; + std::vector> unbundled_data_chunks; while (true) { auto chunk = supplier->GetNextChunk(); if (chunk == nullptr) { @@ -728,7 +727,7 @@ void EdgeTable::BatchAddEdges(const IndexerType& src_indexer, bundled_data_cols.push_back(chunk->get(2)); } else { // Unbundled: collect remaining columns as a DataChunk. - auto prop_chunk = std::make_shared(); + auto prop_chunk = std::make_shared(); for (size_t i = 2; i < chunk->col_num(); ++i) { auto c = chunk->get(static_cast(i)); if (c) { @@ -765,7 +764,7 @@ void EdgeTable::BatchAddEdges(const IndexerType& src_indexer, void EdgeTable::BatchAddEdges( const std::vector& src_lid_list, const std::vector& dst_lid_list, - const std::vector>& edge_data_list) { + const std::vector>& edge_data_list) { size_t new_size = table_idx_.load() + src_lid_list.size(); if (new_size >= Capacity()) { auto new_cap = new_size; @@ -775,7 +774,7 @@ void EdgeTable::BatchAddEdges( EnsureCapacity(new_cap); } if (meta_->is_bundled()) { - std::vector flat_edge_data; + std::vector flat_edge_data; assert(meta_->properties.size() == 1); if (meta_->properties[0] == DataTypeId::kEmpty) { } else { @@ -872,7 +871,7 @@ void EdgeTable::dropAndCreateNewBundledCSR(Checkpoint& ckp, auto row_id_col = dynamic_cast(row_id_col_base.get()); row_id_col->Open(ckp, ModuleDescriptor(), MemoryLevel::kInMemory); auto edges = out_csr_->batch_export(row_id_col); - std::vector remaining_data; + std::vector remaining_data; remaining_data.reserve(row_id_col->size()); for (size_t i = 0; i < row_id_col->size(); ++i) { auto row_id = row_id_col->get_view(i); diff --git a/src/storages/graph/graph_interface.cc b/src/storages/graph/graph_interface.cc index 3c609aa43..df16abe46 100644 --- a/src/storages/graph/graph_interface.cc +++ b/src/storages/graph/graph_interface.cc @@ -17,23 +17,24 @@ namespace neug { -Status StorageAPUpdateInterface::UpdateVertexProperty( - label_t label, vid_t lid, int col_id, const execution::Value& value) { +Status StorageAPUpdateInterface::UpdateVertexProperty(label_t label, vid_t lid, + int col_id, + const Value& value) { return graph_.UpdateVertexProperty(label, lid, col_id, value, timestamp_); } Status StorageAPUpdateInterface::UpdateEdgeProperty( label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& value) { + const Value& value) { return graph_.UpdateEdgeProperty(src_label, src, dst_label, dst, edge_label, oe_offset, ie_offset, col_id, value, neug::timestamp_t(0)); } -Status StorageAPUpdateInterface::AddVertex( - label_t label, const execution::Value& id, - const std::vector& props, vid_t& vid) { +Status StorageAPUpdateInterface::AddVertex(label_t label, const Value& id, + const std::vector& props, + vid_t& vid) { const auto& vertex_table = graph_.get_vertex_table(label); if (vertex_table.Size() >= vertex_table.Capacity()) { auto new_cap = vertex_table.Size() < 4096 @@ -56,10 +57,11 @@ Status StorageAPUpdateInterface::AddVertex( return status; } -Status StorageAPUpdateInterface::AddEdge( - label_t src_label, vid_t src, label_t dst_label, vid_t dst, - label_t edge_label, const std::vector& properties, - const void*& prop) { +Status StorageAPUpdateInterface::AddEdge(label_t src_label, vid_t src, + label_t dst_label, vid_t dst, + label_t edge_label, + const std::vector& properties, + const void*& prop) { const auto& edge_table = graph_.get_edge_table(src_label, dst_label, edge_label); if (edge_table.PropTableSize() >= edge_table.Capacity()) { diff --git a/src/storages/graph/graph_view.cc b/src/storages/graph/graph_view.cc index d8e6c5217..1e449f9c0 100644 --- a/src/storages/graph/graph_view.cc +++ b/src/storages/graph/graph_view.cc @@ -55,8 +55,7 @@ ColumnBase* TableView::get_raw_column(int col_id) const { return columns_[col_id]; } -void TableView::insert(size_t index, - const std::vector& values, +void TableView::insert(size_t index, const std::vector& values, bool insert_safe) { assert(!insert_safe); assert(values.size() == columns_.size()); @@ -73,7 +72,7 @@ VertexTableView::VertexTableView(VertexTable& table) v_ts_(table.v_ts_.get()), view_(*table.table_) {} -bool VertexTableView::get_lid(const execution::Value& oid, vid_t& lid, +bool VertexTableView::get_lid(const Value& oid, vid_t& lid, timestamp_t ts) const { auto res = indexer_->get_index(oid, lid); if (NEUG_UNLIKELY(res && !v_ts_->IsVertexValid(lid, ts))) { @@ -88,7 +87,7 @@ bool VertexTableView::IsValidLid(vid_t lid, timestamp_t ts) const { return lid < indexer_->size() && v_ts_->IsVertexValid(lid, ts); } -execution::Value VertexTableView::GetOid(vid_t lid, timestamp_t ts) const { +Value VertexTableView::GetOid(vid_t lid, timestamp_t ts) const { if (NEUG_UNLIKELY(lid >= indexer_->size())) { THROW_INVALID_ARGUMENT_EXCEPTION("Lid " + std::to_string(lid) + " is out of range."); @@ -117,9 +116,9 @@ std::shared_ptr VertexTableView::GetPropertyColumn( return view_.get_column(prop); } -bool VertexTableView::AddVertex(const execution::Value& id, - const std::vector& props, - vid_t& ret, timestamp_t ts, bool insert_safe) { +bool VertexTableView::AddVertex(const Value& id, + const std::vector& props, vid_t& ret, + timestamp_t ts, bool insert_safe) { assert(!insert_safe); // insert_safe should be false if (indexer_->capacity() <= indexer_->size()) { return false; @@ -180,9 +179,8 @@ EdgeDataAccessor EdgeTableView::GetDataAccessor( } std::pair EdgeTableView::AddEdge( - vid_t src_lid, vid_t dst_lid, - const std::vector& properties, timestamp_t ts, - Allocator& alloc, bool insert_safe) { + vid_t src_lid, vid_t dst_lid, const std::vector& properties, + timestamp_t ts, Allocator& alloc, bool insert_safe) { return internal::insert_edge_into_csr_internal( *out_csr_, *in_csr_, view_, *table_idx_, *meta_, src_lid, dst_lid, properties, ts, alloc, insert_safe); @@ -221,8 +219,7 @@ VertexSet GraphView::GetVertexSet(label_t label, timestamp_t ts) const { return vertex_views_[label].GetVertexSet(ts); } -execution::Value GraphView::GetOid(label_t label, vid_t lid, - timestamp_t ts) const { +Value GraphView::GetOid(label_t label, vid_t lid, timestamp_t ts) const { return vertex_views_[label].GetOid(lid, ts); } @@ -279,9 +276,9 @@ EdgeDataAccessor GraphView::GetEdgeDataAccessor( return it->second.GetDataAccessor(prop_name); } -Status GraphView::AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& vid, timestamp_t ts) { +Status GraphView::AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid, + timestamp_t ts) { if (!vertex_views_[label].AddVertex(id, props, vid, ts, false)) { return Status(StatusCode::ERR_INVALID_ARGUMENT, "Fail to add vertex."); } @@ -290,8 +287,8 @@ Status GraphView::AddVertex(label_t label, const execution::Value& id, Status GraphView::AddEdge(label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, label_t edge_label, - const std::vector& properties, - timestamp_t ts, Allocator& alloc, int32_t& oe_offset, + const std::vector& properties, timestamp_t ts, + Allocator& alloc, int32_t& oe_offset, const void*& prop) { uint32_t index = schema_->generate_edge_label(src_label, dst_label, edge_label); diff --git a/src/storages/graph/operation_params.cc b/src/storages/graph/operation_params.cc index 56b00d591..13d4e32bd 100644 --- a/src/storages/graph/operation_params.cc +++ b/src/storages/graph/operation_params.cc @@ -15,7 +15,7 @@ #include "neug/storages/graph/operation_params.h" #include "neug/common/extra_type_info.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/schema.h" #include "neug/utils/serialization/in_archive.h" #include "neug/utils/serialization/out_archive.h" @@ -44,7 +44,7 @@ CreateVertexTypeParam CreateVertexTypeParam::Deserialize(OutArchive& arc) { for (size_t i = 0; i < prop_size; ++i) { DataType type; std::string name; - execution::Value default_value; + Value default_value; arc >> type >> name >> default_value; builder.AddProperty(name, default_value); } @@ -84,7 +84,7 @@ CreateEdgeTypeParam CreateEdgeTypeParam::Deserialize(OutArchive& arc) { for (size_t i = 0; i < prop_size; ++i) { DataType type; std::string name; - execution::Value default_value; + Value default_value; arc >> type >> name >> default_value; builder.AddProperty(name, default_value); } @@ -120,7 +120,7 @@ AddVertexPropertiesParam AddVertexPropertiesParam::Deserialize( for (size_t i = 0; i < prop_size; ++i) { DataType type; std::string name; - execution::Value default_value; + Value default_value; arc >> type >> name >> default_value; builder.AddProperty(name, default_value); } @@ -147,7 +147,7 @@ AddEdgePropertiesParam AddEdgePropertiesParam::Deserialize(OutArchive& arc) { for (size_t i = 0; i < prop_size; ++i) { DataType type; std::string name; - execution::Value default_value; + Value default_value; arc >> type >> name >> default_value; builder.AddProperty(name, default_value); } diff --git a/src/storages/graph/property_graph.cc b/src/storages/graph/property_graph.cc index 030e1c1cf..090bf2a5e 100644 --- a/src/storages/graph/property_graph.cc +++ b/src/storages/graph/property_graph.cc @@ -161,7 +161,7 @@ Status PropertyGraph::CreateVertexType(const CreateVertexTypeParam& config) { } std::vector property_names; std::vector property_types; - std::vector default_property_values; + std::vector default_property_values; std::vector> primary_keys; const auto& primary_key_names = config.GetPrimaryKeyNames(); std::vector primary_key_inds(primary_key_names.size(), -1); @@ -286,7 +286,7 @@ Status PropertyGraph::CreateEdgeType(const CreateEdgeTypeParam& config) { } std::vector property_names; std::vector property_types; - std::vector default_property_values; + std::vector default_property_values; const auto& properties = config.GetProperties(); for (size_t i = 0; i < properties.size(); i++) { const auto& [name, default_value] = properties[i]; @@ -335,7 +335,7 @@ Status PropertyGraph::AddVertexProperties( RETURN_IF_NOT_OK(vertex_label_check(vertex_type_name)); std::vector add_property_names; std::vector add_property_types; - std::vector add_default_property_values; + std::vector add_default_property_values; for (size_t i = 0; i < add_properties.size(); i++) { const auto& [property_name, default_value] = add_properties[i]; if (schema_.vertex_has_property(vertex_type_name, property_name)) { @@ -368,7 +368,7 @@ Status PropertyGraph::AddEdgeProperties(const AddEdgePropertiesParam& config) { edge_triplet_check(src_type_name, dst_type_name, edge_type_name)); std::vector add_property_names; std::vector add_property_types; - std::vector add_default_props; + std::vector add_default_props; for (size_t i = 0; i < add_properties.size(); i++) { const auto& [property_name, default_value] = add_properties[i]; if (schema_.edge_has_property(src_type_name, dst_type_name, edge_type_name, @@ -660,7 +660,7 @@ Status PropertyGraph::BatchDeleteVertices(label_t v_label_id, return Status::OK(); } -Status PropertyGraph::DeleteVertex(label_t label, const execution::Value& oid, +Status PropertyGraph::DeleteVertex(label_t label, const Value& oid, timestamp_t ts) { RETURN_IF_NOT_OK(vertex_label_check(label)); vid_t lid; @@ -1014,20 +1014,19 @@ size_t PropertyGraph::EdgeNum(label_t src_label, label_t edge_label, } } -bool PropertyGraph::get_lid(label_t label, const execution::Value& oid, - vid_t& lid, timestamp_t ts) const { +bool PropertyGraph::get_lid(label_t label, const Value& oid, vid_t& lid, + timestamp_t ts) const { schema_.ensure_vertex_label_valid(label); return vertex_tables_[label].get_index(oid, lid, ts); } -execution::Value PropertyGraph::GetOid(label_t label, vid_t lid, - timestamp_t ts) const { +Value PropertyGraph::GetOid(label_t label, vid_t lid, timestamp_t ts) const { return vertex_tables_[label].GetOid(lid, ts); } -Status PropertyGraph::AddVertex(label_t label, const execution::Value& id, - const std::vector& props, - vid_t& ret, timestamp_t ts, bool insert_safe) { +Status PropertyGraph::AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& ret, + timestamp_t ts, bool insert_safe) { RETURN_IF_NOT_OK(vertex_label_check(label)); if (!vertex_tables_[label].AddVertex(id, props, ret, ts, insert_safe)) { return Status(StatusCode::ERR_INVALID_ARGUMENT, "Fail to add vertex."); @@ -1035,13 +1034,10 @@ Status PropertyGraph::AddVertex(label_t label, const execution::Value& id, return Status::OK(); } -Status PropertyGraph::AddEdge(label_t src_label, vid_t src_lid, - label_t dst_label, vid_t dst_lid, - label_t edge_label, - const std::vector& properties, - timestamp_t ts, Allocator& alloc, - int32_t& oe_offset, const void*& prop, - bool insert_safe) { +Status PropertyGraph::AddEdge( + label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, + label_t edge_label, const std::vector& properties, timestamp_t ts, + Allocator& alloc, int32_t& oe_offset, const void*& prop, bool insert_safe) { RETURN_IF_NOT_OK(edge_triplet_check(src_label, dst_label, edge_label)); size_t index = schema_.generate_edge_label(src_label, dst_label, edge_label); if (edge_tables_.count(index) == 0) { @@ -1065,8 +1061,7 @@ Status PropertyGraph::AddEdge(label_t src_label, vid_t src_lid, } Status PropertyGraph::UpdateVertexProperty(label_t v_label, vid_t vid, - int32_t prop_id, - const execution::Value& value, + int32_t prop_id, const Value& value, timestamp_t ts) { assert(prop_id >= 0); RETURN_IF_NOT_OK(vertex_label_check(v_label)); @@ -1081,8 +1076,7 @@ Status PropertyGraph::UpdateEdgeProperty(label_t src_v_label, vid_t src_vid, label_t dst_v_label, vid_t dst_vid, label_t e_label, int32_t oe_offset, int32_t ie_offset, int32_t prop_id, - const execution::Value& value, - timestamp_t ts) { + const Value& value, timestamp_t ts) { assert(prop_id >= 0); RETURN_IF_NOT_OK(edge_triplet_check(src_v_label, dst_v_label, e_label)); size_t index = schema_.generate_edge_label(src_v_label, dst_v_label, e_label); diff --git a/src/storages/graph/schema.cc b/src/storages/graph/schema.cc index 4da5e5478..9d9518d71 100644 --- a/src/storages/graph/schema.cc +++ b/src/storages/graph/schema.cc @@ -41,8 +41,6 @@ namespace neug { -using execution::Value; - std::shared_ptr parse_extra_type_info(YAML::Node node) { try { return node.as>(); diff --git a/src/storages/graph/vertex_table.cc b/src/storages/graph/vertex_table.cc index 34085ec2e..6cffe1115 100644 --- a/src/storages/graph/vertex_table.cc +++ b/src/storages/graph/vertex_table.cc @@ -89,7 +89,7 @@ void VertexTable::SetVertexSchema( vertex_schema_ = vertex_schema; } -bool VertexTable::get_index(const execution::Value& oid, vid_t& lid, +bool VertexTable::get_index(const Value& oid, vid_t& lid, timestamp_t ts) const { auto res = indexer_->get_index(oid, lid); if (NEUG_UNLIKELY(res && !v_ts_->IsVertexValid(lid, ts))) { @@ -106,8 +106,8 @@ size_t VertexTable::LidNum() const { return indexer_->size(); } vid_t internal::insert_vertex_pk_internal(IndexerType& indexer, VertexTimestamp& v_ts, - const execution::Value& id, - timestamp_t ts, bool insert_safe) { + const Value& id, timestamp_t ts, + bool insert_safe) { vid_t vid; if (NEUG_UNLIKELY(indexer.get_index(id, vid))) { if (NEUG_UNLIKELY(v_ts.IsVertexValid(vid, ts))) { @@ -122,8 +122,7 @@ vid_t internal::insert_vertex_pk_internal(IndexerType& indexer, return vid; } -bool VertexTable::AddVertex(const execution::Value& id, - const std::vector& props, +bool VertexTable::AddVertex(const Value& id, const std::vector& props, vid_t& vid, timestamp_t ts, bool insert_safe) { if (indexer_->capacity() <= indexer_->size()) { return false; @@ -141,8 +140,7 @@ bool VertexTable::AddVertex(const execution::Value& id, return true; } -bool VertexTable::UpdateProperty(vid_t vid, int32_t prop_id, - const execution::Value& value, +bool VertexTable::UpdateProperty(vid_t vid, int32_t prop_id, const Value& value, timestamp_t ts) { if (NEUG_UNLIKELY(vid >= indexer_->size())) { LOG(ERROR) << "Lid " << vid << " is out of range."; @@ -161,7 +159,7 @@ bool VertexTable::UpdateProperty(vid_t vid, int32_t prop_id, return true; } -execution::Value VertexTable::GetOid(vid_t lid, timestamp_t ts) const { +Value VertexTable::GetOid(vid_t lid, timestamp_t ts) const { if (NEUG_UNLIKELY(lid >= indexer_->size())) { THROW_INVALID_ARGUMENT_EXCEPTION("Lid " + std::to_string(lid) + " is out of range."); @@ -203,7 +201,7 @@ void VertexTable::BatchDeleteVertices(const std::vector& vids) { VLOG(10) << "Deleted " << delete_cnt << " vertices in batch."; } -void VertexTable::DeleteVertex(const execution::Value& id, timestamp_t ts) { +void VertexTable::DeleteVertex(const Value& id, timestamp_t ts) { vid_t vid; if (!get_index(id, vid, ts)) { LOG(WARNING) << "Vertex with id " << id.to_string() << " not found."; @@ -239,10 +237,10 @@ void VertexTable::DeleteProperties(const std::vector& properties) { } } -void VertexTable::AddProperties( - Checkpoint& ckp, const std::vector& properties, - const std::vector& types, - const std::vector& default_values) { +void VertexTable::AddProperties(Checkpoint& ckp, + const std::vector& properties, + const std::vector& types, + const std::vector& default_values) { table_->add_columns(ckp, properties, types, default_values, indexer_->capacity(), memory_level_); } @@ -260,7 +258,7 @@ void VertexTable::Compact(timestamp_t ts) { // TODO(zhanglei): Support compact unused lid in indexer_ and table } -vid_t VertexTable::insert_vertex_pk(const execution::Value& id, timestamp_t ts, +vid_t VertexTable::insert_vertex_pk(const Value& id, timestamp_t ts, bool insert_safe) { return internal::insert_vertex_pk_internal(*indexer_, *v_ts_, id, ts, insert_safe); diff --git a/src/storages/loader/loader_utils.cc b/src/storages/loader/loader_utils.cc index aeff89b1a..e88587cd0 100644 --- a/src/storages/loader/loader_utils.cc +++ b/src/storages/loader/loader_utils.cc @@ -28,8 +28,8 @@ #include #include "csv.hpp" -#include "neug/execution/common/columns/columns_utils.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/types/value.h" #include "neug/utils/datetime_parsers.h" #include "neug/utils/exception/exception.h" #include "neug/utils/property/column.h" @@ -155,36 +155,33 @@ std::string canonicalize_bool_token( } template -execution::Value parse_typed_value(const std::string& token) { - return execution::Value::CreateValue( - execution::ValueConverter::typed_from_string(token)); +Value parse_typed_value(const std::string& token) { + return Value::CreateValue(ValueConverter::typed_from_string(token)); } -execution::Value parse_date_value(const std::string& token) { +Value parse_date_value(const std::string& token) { int64_t millis = 0; if (parse_timestamp_ms(token, &millis) || parse_epoch_timestamp_ms(token, &millis)) { Date d; d.from_timestamp(millis); - return execution::Value::CreateValue(d); + return Value::CreateValue(d); } - return parse_typed_value(token); + return parse_typed_value(token); } -execution::Value parse_timestamp_value(const std::string& token) { +Value parse_timestamp_value(const std::string& token) { int64_t millis = 0; if (parse_timestamp_ms(token, &millis) || parse_epoch_timestamp_ms(token, &millis)) { - return execution::Value::CreateValue( - DateTime(millis)); + return Value::CreateValue(DateTime(millis)); } - return parse_typed_value(token); + return parse_typed_value(token); } -execution::Value parse_value_by_type( - const std::string& token, const DataType& data_type, - const std::unordered_set& true_values, - const std::unordered_set& false_values) { +Value parse_value_by_type(const std::string& token, const DataType& data_type, + const std::unordered_set& true_values, + const std::unordered_set& false_values) { switch (data_type.id()) { case DataTypeId::kInt32: return parse_typed_value(token); @@ -206,7 +203,7 @@ execution::Value parse_value_by_type( case DataTypeId::kTimestampMs: return parse_timestamp_value(token); case DataTypeId::kInterval: - return parse_typed_value(token); + return parse_typed_value(token); case DataTypeId::kVarchar: return parse_typed_value(token); default: @@ -230,9 +227,8 @@ std::string unescape_token(const std::string& token, char escape_char) { } void append_csv_field_to_builder( - std::shared_ptr& builder, - const DataType& data_type, csv::CSVField field, - const std::unordered_set& null_values, + std::shared_ptr& builder, const DataType& data_type, + csv::CSVField field, const std::unordered_set& null_values, const std::unordered_set& true_values, const std::unordered_set& false_values, const std::string& file_path, int64_t row_number, @@ -290,15 +286,15 @@ struct CsvSupplierRuntime { reset_reader(); } - std::shared_ptr get_next_chunk() { + std::shared_ptr get_next_chunk() { if (!reader_) { return nullptr; } - std::vector> builders; + std::vector> builders; builders.reserve(selected_column_types_.size()); for (const auto& column_type : selected_column_types_) { - auto builder = execution::ColumnsUtils::create_builder(column_type); + auto builder = ColumnsUtils::create_builder(column_type); builder->reserve(chunk_size_); builders.emplace_back(std::move(builder)); } @@ -331,7 +327,7 @@ struct CsvSupplierRuntime { return nullptr; } - auto chunk = std::make_shared(); + auto chunk = std::make_shared(); for (size_t column_index = 0; column_index < builders.size(); ++column_index) { chunk->set(static_cast(column_index), @@ -709,7 +705,7 @@ CSVChunkSupplier::CSVChunkSupplier(const std::string& file_path, CSVChunkSupplier::~CSVChunkSupplier() = default; -std::shared_ptr CSVChunkSupplier::GetNextChunk() { +std::shared_ptr CSVChunkSupplier::GetNextChunk() { if (!runtime_) { THROW_IO_EXCEPTION("CSV runtime is null for file: " + file_path_); } @@ -955,8 +951,7 @@ void fillEdgeReaderMeta(label_t src_label_id, label_t dst_label_id, } void set_properties_from_context_column( - neug::ColumnBase* col, - const std::shared_ptr& ctx_col, + neug::ColumnBase* col, const std::shared_ptr& ctx_col, const std::vector& vids, std::shared_mutex& mutex) { // Row-by-row via get_elem() auto col_type = col->type(); diff --git a/src/transaction/insert_transaction.cc b/src/transaction/insert_transaction.cc index f009d9802..3e48b1cb6 100644 --- a/src/transaction/insert_transaction.cc +++ b/src/transaction/insert_transaction.cc @@ -22,7 +22,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/graph/schema.h" #include "neug/transaction/transaction_utils.h" @@ -47,8 +47,7 @@ InsertTransaction::InsertTransaction(SnapshotGuard guard, Allocator& alloc, InsertTransaction::~InsertTransaction() { Abort(); } -bool InsertTransaction::GetVertexIndex(label_t label, - const execution::Value& id, +bool InsertTransaction::GetVertexIndex(label_t label, const Value& id, vid_t& index) const { if (view_->get_lid(label, id, index, timestamp_)) { return true; @@ -61,14 +60,13 @@ bool InsertTransaction::GetVertexIndex(label_t label, return false; } -execution::Value InsertTransaction::get_vertex_id(label_t label, - vid_t lid) const { +Value InsertTransaction::get_vertex_id(label_t label, vid_t lid) const { if (added_vertices_.size() <= label || added_vertices_[label] == nullptr) { return view_->GetOid(label, lid, timestamp_); } vid_t base = added_vertices_base_[label]; if (lid >= base) { - execution::Value ret{DataType{DataTypeId::kNull}}; + Value ret{DataType{DataTypeId::kNull}}; CHECK(added_vertices_[label]->get_key(lid - base, ret)); return ret; } else { @@ -76,8 +74,8 @@ execution::Value InsertTransaction::get_vertex_id(label_t label, } } -Status InsertTransaction::AddVertex(label_t label, const execution::Value& id, - const std::vector& props, +Status InsertTransaction::AddVertex(label_t label, const Value& id, + const std::vector& props, vid_t& vid) { std::vector types = view_->schema().get_vertex_properties(label); if (types.size() != props.size()) { @@ -117,10 +115,11 @@ Status InsertTransaction::AddVertex(label_t label, const execution::Value& id, return Status::OK(); } -Status InsertTransaction::AddEdge( - label_t src_label, vid_t src_vid, label_t dst_label, vid_t dst_vid, - label_t edge_label, const std::vector& properties, - const void*& prop) { +Status InsertTransaction::AddEdge(label_t src_label, vid_t src_vid, + label_t dst_label, vid_t dst_vid, + label_t edge_label, + const std::vector& properties, + const void*& prop) { const auto& src = get_vertex_id(src_label, src_vid); const auto& dst = get_vertex_id(dst_label, dst_vid); const auto& types = diff --git a/src/transaction/update_transaction.cc b/src/transaction/update_transaction.cc index b0177e899..a0598100e 100644 --- a/src/transaction/update_transaction.cc +++ b/src/transaction/update_transaction.cc @@ -26,7 +26,7 @@ #include #include "neug/common/extra_type_info.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/allocators.h" #include "neug/storages/csr/csr_base.h" #include "neug/storages/csr/csr_view_utils.h" @@ -590,9 +590,9 @@ Status StorageTPUpdateInterface::DeleteEdgeType(const std::string& src_type, return status; } -Status StorageTPUpdateInterface::AddVertex( - label_t label, const execution::Value& oid, - const std::vector& props, vid_t& vid) { +Status StorageTPUpdateInterface::AddVertex(label_t label, const Value& oid, + const std::vector& props, + vid_t& vid) { std::vector types = cow_graph_->schema().get_vertex_properties(label); if (types.size() != props.size()) { @@ -648,10 +648,11 @@ Status StorageTPUpdateInterface::DeleteVertex(label_t label, vid_t lid) { return cow_graph_->DeleteVertex(label, lid, read_ts_); } -Status StorageTPUpdateInterface::AddEdge( - label_t src_label, vid_t src_lid, label_t dst_label, vid_t dst_lid, - label_t edge_label, const std::vector& properties, - const void*& prop) { +Status StorageTPUpdateInterface::AddEdge(label_t src_label, vid_t src_lid, + label_t dst_label, vid_t dst_lid, + label_t edge_label, + const std::vector& properties, + const void*& prop) { const auto& edge_table = cow_graph_->get_edge_table(src_label, dst_label, edge_label); if (edge_table.PropTableSize() >= edge_table.Capacity()) { @@ -750,8 +751,8 @@ Status StorageTPUpdateInterface::DeleteEdge(label_t src_label, vid_t src_lid, edge_label, oe_offset, ie_offset, read_ts_); } -execution::Value UpdateTransaction::GetVertexProperty(label_t label, vid_t lid, - int col_id) const { +Value UpdateTransaction::GetVertexProperty(label_t label, vid_t lid, + int col_id) const { auto col = cow_graph_->GetVertexPropertyColumn(label, col_id); if (!cow_graph_->IsValidLid(label, lid, timestamp_)) { THROW_INVALID_ARGUMENT_EXCEPTION( @@ -763,19 +764,18 @@ execution::Value UpdateTransaction::GetVertexProperty(label_t label, vid_t lid, return col->get_any(lid); } -execution::Value UpdateTransaction::GetVertexId(label_t label, - vid_t lid) const { +Value UpdateTransaction::GetVertexId(label_t label, vid_t lid) const { return cow_graph_->GetOid(label, lid, timestamp_); } -bool UpdateTransaction::GetVertexIndex(label_t label, - const execution::Value& id, +bool UpdateTransaction::GetVertexIndex(label_t label, const Value& id, vid_t& index) const { return cow_graph_->get_lid(label, id, index, timestamp_); } -Status StorageTPUpdateInterface::UpdateVertexProperty( - label_t label, vid_t lid, int col_id, const execution::Value& value) { +Status StorageTPUpdateInterface::UpdateVertexProperty(label_t label, vid_t lid, + int col_id, + const Value& value) { if (!cow_graph_->IsValidLid(label, lid, read_ts_)) { return Status(StatusCode::ERR_INVALID_ARGUMENT, "Vertex lid " + std::to_string(lid) + " of label " + @@ -801,7 +801,7 @@ Status StorageTPUpdateInterface::UpdateVertexProperty( Status StorageTPUpdateInterface::UpdateEdgeProperty( label_t src_label, vid_t src, label_t dst_label, vid_t dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset, int32_t col_id, - const execution::Value& value) { + const Value& value) { if (!cow_graph_->IsValidLid(src_label, src, read_ts_) || !cow_graph_->IsValidLid(dst_label, dst, read_ts_)) { return Status(StatusCode::ERR_INVALID_ARGUMENT, diff --git a/src/transaction/wal/wal.cc b/src/transaction/wal/wal.cc index a758daf3d..c5d111892 100644 --- a/src/transaction/wal/wal.cc +++ b/src/transaction/wal/wal.cc @@ -23,7 +23,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/transaction/wal/dummy_wal_writer.h" #include "neug/utils/serialization/in_archive.h" #include "neug/utils/serialization/out_archive.h" @@ -249,8 +249,8 @@ void DeleteEdgeTypeRedo::Deserialize(OutArchive& arc, } void InsertVertexRedo::Serialize(InArchive& arc, label_t label, - const execution::Value& oid, - const std::vector& props) { + const Value& oid, + const std::vector& props) { arc << static_cast(OpType::kInsertVertex); arc << label << oid; arc << static_cast(props.size()); @@ -269,10 +269,10 @@ void InsertVertexRedo::Deserialize(OutArchive& arc, InsertVertexRedo& redo) { } } -void InsertEdgeRedo::Serialize( - InArchive& arc, label_t src_label, const execution::Value& src, - label_t dst_label, const execution::Value& dst, label_t edge_label, - const std::vector& properties) { +void InsertEdgeRedo::Serialize(InArchive& arc, label_t src_label, + const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, + const std::vector& properties) { arc << static_cast(OpType::kInsertEdge); arc << src_label << src << dst_label << dst << edge_label; arc << static_cast(properties.size()); @@ -293,8 +293,8 @@ void InsertEdgeRedo::Deserialize(OutArchive& arc, InsertEdgeRedo& redo) { } void UpdateVertexPropRedo::Serialize(InArchive& arc, label_t label, - const execution::Value& oid, int prop_id, - const execution::Value& value) { + const Value& oid, int prop_id, + const Value& value) { arc << static_cast(OpType::kUpdateVertexProp); arc << label << oid << prop_id << value; } @@ -305,12 +305,10 @@ void UpdateVertexPropRedo::Deserialize(OutArchive& arc, } void UpdateEdgePropRedo::Serialize(InArchive& arc, label_t src_label, - const execution::Value& src, - label_t dst_label, - const execution::Value& dst, - label_t edge_label, int32_t oe_offset, - int32_t ie_offset, int prop_id, - const execution::Value& value) { + const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, + int32_t oe_offset, int32_t ie_offset, + int prop_id, const Value& value) { arc << static_cast(OpType::kUpdateEdgeProp); arc << src_label << src << dst_label << dst << edge_label; arc << oe_offset << ie_offset; @@ -326,7 +324,7 @@ void UpdateEdgePropRedo::Deserialize(OutArchive& arc, } void RemoveVertexRedo::Serialize(InArchive& arc, label_t label, - const execution::Value& oid) { + const Value& oid) { arc << static_cast(OpType::kRemoveVertex); arc << label << oid; } @@ -336,8 +334,8 @@ void RemoveVertexRedo::Deserialize(OutArchive& arc, RemoveVertexRedo& redo) { } void RemoveEdgeRedo::Serialize(InArchive& arc, label_t src_label, - const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, + const Value& src, label_t dst_label, + const Value& dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset) { arc << static_cast(OpType::kRemoveEdge); arc << src_label << src << dst_label << dst << edge_label; diff --git a/src/transaction/wal/wal_builder.cc b/src/transaction/wal/wal_builder.cc index 827ff5237..341a4bc0a 100644 --- a/src/transaction/wal/wal_builder.cc +++ b/src/transaction/wal/wal_builder.cc @@ -109,45 +109,45 @@ void WalBuilder::LogDeleteEdgeType(const std::string& src_type, // DML logging // ============================================================================= -void WalBuilder::LogInsertVertex(label_t label, const execution::Value& oid, - const std::vector& props) { +void WalBuilder::LogInsertVertex(label_t label, const Value& oid, + const std::vector& props) { InsertVertexRedo::Serialize(arc_, label, oid, props); ++op_num_; } -void WalBuilder::LogInsertEdge( - label_t src_label, const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, - const std::vector& properties) { +void WalBuilder::LogInsertEdge(label_t src_label, const Value& src, + label_t dst_label, const Value& dst, + label_t edge_label, + const std::vector& properties) { InsertEdgeRedo::Serialize(arc_, src_label, src, dst_label, dst, edge_label, properties); ++op_num_; } -void WalBuilder::LogUpdateVertexProp(label_t label, const execution::Value& oid, - int prop_id, - const execution::Value& value) { +void WalBuilder::LogUpdateVertexProp(label_t label, const Value& oid, + int prop_id, const Value& value) { UpdateVertexPropRedo::Serialize(arc_, label, oid, prop_id, value); ++op_num_; } -void WalBuilder::LogUpdateEdgeProp( - label_t src_label, const execution::Value& src, label_t dst_label, - const execution::Value& dst, label_t edge_label, int32_t oe_offset, - int32_t ie_offset, int prop_id, const execution::Value& value) { +void WalBuilder::LogUpdateEdgeProp(label_t src_label, const Value& src, + label_t dst_label, const Value& dst, + label_t edge_label, int32_t oe_offset, + int32_t ie_offset, int prop_id, + const Value& value) { UpdateEdgePropRedo::Serialize(arc_, src_label, src, dst_label, dst, edge_label, oe_offset, ie_offset, prop_id, value); ++op_num_; } -void WalBuilder::LogRemoveVertex(label_t label, const execution::Value& oid) { +void WalBuilder::LogRemoveVertex(label_t label, const Value& oid) { RemoveVertexRedo::Serialize(arc_, label, oid); ++op_num_; } -void WalBuilder::LogRemoveEdge(label_t src_label, const execution::Value& src, - label_t dst_label, const execution::Value& dst, +void WalBuilder::LogRemoveEdge(label_t src_label, const Value& src, + label_t dst_label, const Value& dst, label_t edge_label, int32_t oe_offset, int32_t ie_offset) { RemoveEdgeRedo::Serialize(arc_, src_label, src, dst_label, dst, edge_label, diff --git a/src/utils/io/read/common/row_expression_filter.cc b/src/utils/io/read/common/row_expression_filter.cc index 0b890c784..5c9063b01 100644 --- a/src/utils/io/read/common/row_expression_filter.cc +++ b/src/utils/io/read/common/row_expression_filter.cc @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/generated/proto/plan/expr.pb.h" #include "neug/storages/loader/loader_utils.h" #include "neug/utils/exception/exception.h" @@ -29,32 +29,31 @@ namespace neug { namespace reader { namespace { -execution::Value proto_value_to_execution(const ::common::Value& value) { +Value proto_value_to_execution(const ::common::Value& value) { switch (value.item_case()) { case ::common::Value::kBoolean: - return execution::Value::BOOLEAN(value.boolean()); + return Value::BOOLEAN(value.boolean()); case ::common::Value::kI32: - return execution::Value::INT32(value.i32()); + return Value::INT32(value.i32()); case ::common::Value::kI64: - return execution::Value::INT64(value.i64()); + return Value::INT64(value.i64()); case ::common::Value::kU32: - return execution::Value::UINT32(value.u32()); + return Value::UINT32(value.u32()); case ::common::Value::kU64: - return execution::Value::UINT64(value.u64()); + return Value::UINT64(value.u64()); case ::common::Value::kF32: - return execution::Value::FLOAT(value.f32()); + return Value::FLOAT(value.f32()); case ::common::Value::kF64: - return execution::Value::DOUBLE(value.f64()); + return Value::DOUBLE(value.f64()); case ::common::Value::kStr: - return execution::Value::STRING(value.str()); + return Value::STRING(value.str()); default: THROW_CONVERSION_EXCEPTION("Unsupported constant type in row filter"); } } -bool compare_values(const ::common::Logical& logical, - const execution::Value& left, - const execution::Value& right) { +bool compare_values(const ::common::Logical& logical, const Value& left, + const Value& right) { switch (logical) { case ::common::Logical::GT: return right < left; @@ -92,8 +91,7 @@ void build_name_to_index(const std::vector& column_names, RowExpressionFilter::RowExpressionFilter( const ::common::Expression& expr, const std::unordered_map& column_index) { - using ValueFn = - std::function; + using ValueFn = std::function; std::stack value_stack; std::stack<::common::ExprOpr> op_stack; @@ -108,12 +106,11 @@ RowExpressionFilter::RowExpressionFilter( } auto operand = value_stack.top(); value_stack.pop(); - value_stack.push( - [operand](const execution::DataChunk& chunk, size_t row) { - return execution::Value::BOOLEAN( - compare_values(::common::Logical::NOT, operand(chunk, row), - execution::Value::BOOLEAN(false))); - }); + value_stack.push([operand](const DataChunk& chunk, size_t row) { + return Value::BOOLEAN(compare_values(::common::Logical::NOT, + operand(chunk, row), + Value::BOOLEAN(false))); + }); return; } if (value_stack.size() < 2) { @@ -125,19 +122,18 @@ RowExpressionFilter::RowExpressionFilter( auto left_fn = value_stack.top(); value_stack.pop(); auto logical = opr.logical(); - value_stack.push([left_fn, right_fn, logical]( - const execution::DataChunk& chunk, size_t row) { - auto left_val = left_fn(chunk, row); - auto right_val = right_fn(chunk, row); - if (logical == ::common::Logical::AND || - logical == ::common::Logical::OR) { - return execution::Value::BOOLEAN(compare_values( - logical, execution::Value::BOOLEAN(left_val.GetValue()), - execution::Value::BOOLEAN(right_val.GetValue()))); - } - return execution::Value::BOOLEAN( - compare_values(logical, left_val, right_val)); - }); + value_stack.push( + [left_fn, right_fn, logical](const DataChunk& chunk, size_t row) { + auto left_val = left_fn(chunk, row); + auto right_val = right_fn(chunk, row); + if (logical == ::common::Logical::AND || + logical == ::common::Logical::OR) { + return Value::BOOLEAN(compare_values( + logical, Value::BOOLEAN(left_val.GetValue()), + Value::BOOLEAN(right_val.GetValue()))); + } + return Value::BOOLEAN(compare_values(logical, left_val, right_val)); + }); }; for (int i = 0; i < expr.operators_size(); ++i) { @@ -145,8 +141,7 @@ RowExpressionFilter::RowExpressionFilter( switch (opr.item_case()) { case ::common::ExprOpr::kConst: { auto value = proto_value_to_execution(opr.const_()); - value_stack.push( - [value](const execution::DataChunk&, size_t) { return value; }); + value_stack.push([value](const DataChunk&, size_t) { return value; }); break; } case ::common::ExprOpr::kVar: { @@ -157,15 +152,14 @@ RowExpressionFilter::RowExpressionFilter( column_name); } int col_idx = iter->second; - value_stack.push( - [col_idx](const execution::DataChunk& chunk, size_t row) { - auto col = chunk.get(col_idx); - if (!col) { - THROW_RUNTIME_ERROR("Missing filter column at index " + - std::to_string(col_idx)); - } - return col->get_elem(row); - }); + value_stack.push([col_idx](const DataChunk& chunk, size_t row) { + auto col = chunk.get(col_idx); + if (!col) { + THROW_RUNTIME_ERROR("Missing filter column at index " + + std::to_string(col_idx)); + } + return col->get_elem(row); + }); break; } case ::common::ExprOpr::kBrace: { @@ -217,22 +211,21 @@ RowExpressionFilter::RowExpressionFilter( THROW_INVALID_ARGUMENT_EXCEPTION("Invalid filter expression"); } auto value_fn = value_stack.top(); - evaluator_ = [value_fn](const execution::DataChunk& chunk, size_t row) { + evaluator_ = [value_fn](const DataChunk& chunk, size_t row) { return value_fn(chunk, row).GetValue(); }; } -bool RowExpressionFilter::eval(const execution::DataChunk& chunk, - size_t row) const { +bool RowExpressionFilter::eval(const DataChunk& chunk, size_t row) const { if (!evaluator_) { return true; } return evaluator_(chunk, row); } -execution::DataChunk read_all_chunks( +DataChunk read_all_chunks( const std::vector>& suppliers) { - execution::DataChunk merged; + DataChunk merged; for (const auto& supplier : suppliers) { while (true) { auto chunk = supplier->GetNextChunk(); @@ -249,10 +242,9 @@ execution::DataChunk read_all_chunks( return merged; } -execution::DataChunk filter_chunk( - const execution::DataChunk& input, - const std::shared_ptr<::common::Expression>& filter_expr, - const std::vector& column_names) { +DataChunk filter_chunk(const DataChunk& input, + const std::shared_ptr<::common::Expression>& filter_expr, + const std::vector& column_names) { if (!filter_expr || input.row_num() == 0) { return input; } @@ -269,15 +261,14 @@ execution::DataChunk filter_chunk( } } - execution::DataChunk filtered = input; + DataChunk filtered = input; filtered.reshuffle(keep_offsets); return filtered; } -execution::DataChunk project_chunk( - const execution::DataChunk& input, - const std::vector& column_names, - const std::vector& project_columns) { +DataChunk project_chunk(const DataChunk& input, + const std::vector& column_names, + const std::vector& project_columns) { if (project_columns.empty()) { return input; } @@ -285,7 +276,7 @@ execution::DataChunk project_chunk( std::unordered_map name_to_index; build_name_to_index(column_names, &name_to_index); - execution::DataChunk projected; + DataChunk projected; for (size_t i = 0; i < project_columns.size(); ++i) { auto iter = name_to_index.find(project_columns[i]); if (iter == name_to_index.end()) { diff --git a/src/utils/io/read/csv/csv_reader.cc b/src/utils/io/read/csv/csv_reader.cc index 269d094f6..f7f7fc23e 100644 --- a/src/utils/io/read/csv/csv_reader.cc +++ b/src/utils/io/read/csv/csv_reader.cc @@ -15,7 +15,7 @@ #include "neug/utils/io/reader.h" -#include "neug/execution/common/columns/container_types.h" +#include "neug/common/types/container_types.h" #include @@ -49,24 +49,24 @@ namespace neug { namespace reader { namespace { -execution::Value proto_value_to_execution(const ::common::Value& value) { +Value proto_value_to_execution(const ::common::Value& value) { switch (value.item_case()) { case ::common::Value::kBoolean: - return execution::Value::BOOLEAN(value.boolean()); + return Value::BOOLEAN(value.boolean()); case ::common::Value::kI32: - return execution::Value::INT32(value.i32()); + return Value::INT32(value.i32()); case ::common::Value::kI64: - return execution::Value::INT64(value.i64()); + return Value::INT64(value.i64()); case ::common::Value::kU32: - return execution::Value::UINT32(value.u32()); + return Value::UINT32(value.u32()); case ::common::Value::kU64: - return execution::Value::UINT64(value.u64()); + return Value::UINT64(value.u64()); case ::common::Value::kF32: - return execution::Value::FLOAT(value.f32()); + return Value::FLOAT(value.f32()); case ::common::Value::kF64: - return execution::Value::DOUBLE(value.f64()); + return Value::DOUBLE(value.f64()); case ::common::Value::kStr: - return execution::Value::STRING(value.str()); + return Value::STRING(value.str()); default: THROW_CONVERSION_EXCEPTION("Unsupported constant type in CSV row filter"); } @@ -90,7 +90,7 @@ bool is_numeric_type(DataTypeId id) { } } -double value_to_double(const execution::Value& v) { +double value_to_double(const Value& v) { switch (v.type().id()) { case DataTypeId::kInt8: return static_cast(v.GetValue()); @@ -115,9 +115,8 @@ double value_to_double(const execution::Value& v) { } } -bool compare_values(const ::common::Logical& logical, - const execution::Value& left, - const execution::Value& right) { +bool compare_values(const ::common::Logical& logical, const Value& left, + const Value& right) { // Numeric type coercion: promote both operands to double when types differ. if (left.type() != right.type() && is_numeric_type(left.type().id()) && is_numeric_type(right.type().id())) { @@ -173,7 +172,7 @@ class CsvRowFilter { compile(expr); } - bool eval(const execution::DataChunk& chunk, size_t row) const { + bool eval(const DataChunk& chunk, size_t row) const { if (!evaluator_) { return true; } @@ -181,9 +180,8 @@ class CsvRowFilter { } private: - using ValueFn = - std::function; - using EvalFn = std::function; + using ValueFn = std::function; + using EvalFn = std::function; void compile(const ::common::Expression& expr) { std::stack value_stack; @@ -200,33 +198,33 @@ class CsvRowFilter { auto left_fn = value_stack.top(); value_stack.pop(); auto arith = opr.arith(); - value_stack.push([left_fn, right_fn, arith]( - const execution::DataChunk& chunk, size_t row) { - double l = value_to_double(left_fn(chunk, row)); - double r = value_to_double(right_fn(chunk, row)); - double result = 0; - switch (arith) { - case ::common::Arithmetic::ADD: - result = l + r; - break; - case ::common::Arithmetic::SUB: - result = l - r; - break; - case ::common::Arithmetic::MUL: - result = l * r; - break; - case ::common::Arithmetic::DIV: - result = (r != 0) ? l / r : 0; - break; - case ::common::Arithmetic::MOD: - result = (r != 0) ? std::fmod(l, r) : 0; - break; - default: - result = 0; - break; - } - return execution::Value::DOUBLE(result); - }); + value_stack.push( + [left_fn, right_fn, arith](const DataChunk& chunk, size_t row) { + double l = value_to_double(left_fn(chunk, row)); + double r = value_to_double(right_fn(chunk, row)); + double result = 0; + switch (arith) { + case ::common::Arithmetic::ADD: + result = l + r; + break; + case ::common::Arithmetic::SUB: + result = l - r; + break; + case ::common::Arithmetic::MUL: + result = l * r; + break; + case ::common::Arithmetic::DIV: + result = (r != 0) ? l / r : 0; + break; + case ::common::Arithmetic::MOD: + result = (r != 0) ? std::fmod(l, r) : 0; + break; + default: + result = 0; + break; + } + return Value::DOUBLE(result); + }); return; } if (opr.item_case() != ::common::ExprOpr::kLogical) { @@ -239,12 +237,11 @@ class CsvRowFilter { } auto operand = value_stack.top(); value_stack.pop(); - value_stack.push( - [operand](const execution::DataChunk& chunk, size_t row) { - return execution::Value::BOOLEAN( - compare_values(::common::Logical::NOT, operand(chunk, row), - execution::Value::BOOLEAN(false))); - }); + value_stack.push([operand](const DataChunk& chunk, size_t row) { + return Value::BOOLEAN(compare_values(::common::Logical::NOT, + operand(chunk, row), + Value::BOOLEAN(false))); + }); return; } if (value_stack.size() < 2) { @@ -256,19 +253,18 @@ class CsvRowFilter { auto left_fn = value_stack.top(); value_stack.pop(); auto logical = opr.logical(); - value_stack.push([left_fn, right_fn, logical]( - const execution::DataChunk& chunk, size_t row) { - auto left_val = left_fn(chunk, row); - auto right_val = right_fn(chunk, row); - if (logical == ::common::Logical::AND || - logical == ::common::Logical::OR) { - return execution::Value::BOOLEAN(compare_values( - logical, execution::Value::BOOLEAN(left_val.GetValue()), - execution::Value::BOOLEAN(right_val.GetValue()))); - } - return execution::Value::BOOLEAN( - compare_values(logical, left_val, right_val)); - }); + value_stack.push( + [left_fn, right_fn, logical](const DataChunk& chunk, size_t row) { + auto left_val = left_fn(chunk, row); + auto right_val = right_fn(chunk, row); + if (logical == ::common::Logical::AND || + logical == ::common::Logical::OR) { + return Value::BOOLEAN(compare_values( + logical, Value::BOOLEAN(left_val.GetValue()), + Value::BOOLEAN(right_val.GetValue()))); + } + return Value::BOOLEAN(compare_values(logical, left_val, right_val)); + }); }; for (int i = 0; i < expr.operators_size(); ++i) { @@ -276,8 +272,7 @@ class CsvRowFilter { switch (opr.item_case()) { case ::common::ExprOpr::kConst: { auto value = proto_value_to_execution(opr.const_()); - value_stack.push( - [value](const execution::DataChunk&, size_t) { return value; }); + value_stack.push([value](const DataChunk&, size_t) { return value; }); break; } case ::common::ExprOpr::kVar: { @@ -288,15 +283,14 @@ class CsvRowFilter { column_name); } int col_idx = iter->second; - value_stack.push( - [col_idx](const execution::DataChunk& chunk, size_t row) { - auto col = chunk.get(col_idx); - if (!col) { - THROW_RUNTIME_ERROR("Missing filter column at index " + - std::to_string(col_idx)); - } - return col->get_elem(row); - }); + value_stack.push([col_idx](const DataChunk& chunk, size_t row) { + auto col = chunk.get(col_idx); + if (!col) { + THROW_RUNTIME_ERROR("Missing filter column at index " + + std::to_string(col_idx)); + } + return col->get_elem(row); + }); break; } case ::common::ExprOpr::kBrace: { @@ -346,7 +340,7 @@ class CsvRowFilter { case ::common::ExprOpr::kConst: { auto value = proto_value_to_execution(child_opr.const_()); value_stack.push( - [value](const execution::DataChunk&, size_t) { return value; }); + [value](const DataChunk&, size_t) { return value; }); break; } case ::common::ExprOpr::kVar: { @@ -357,15 +351,14 @@ class CsvRowFilter { col_name); } int idx = it->second; - value_stack.push( - [idx](const execution::DataChunk& chunk, size_t row) { - auto col = chunk.get(idx); - if (!col) { - THROW_RUNTIME_ERROR("Missing filter column at index " + - std::to_string(idx)); - } - return col->get_elem(row); - }); + value_stack.push([idx](const DataChunk& chunk, size_t row) { + auto col = chunk.get(idx); + if (!col) { + THROW_RUNTIME_ERROR("Missing filter column at index " + + std::to_string(idx)); + } + return col->get_elem(row); + }); break; } default: @@ -396,7 +389,7 @@ class CsvRowFilter { THROW_INVALID_ARGUMENT_EXCEPTION("Invalid filter expression"); } auto value_fn = value_stack.top(); - evaluator_ = [value_fn](const execution::DataChunk& chunk, size_t row) { + evaluator_ = [value_fn](const DataChunk& chunk, size_t row) { return value_fn(chunk, row).GetValue(); }; } @@ -405,9 +398,9 @@ class CsvRowFilter { EvalFn evaluator_; }; -execution::DataChunk read_all_chunks( +DataChunk read_all_chunks( const std::vector>& suppliers) { - execution::DataChunk merged; + DataChunk merged; for (const auto& supplier : suppliers) { while (true) { auto chunk = supplier->GetNextChunk(); @@ -431,10 +424,9 @@ void build_name_to_index(const std::vector& column_names, } } -execution::DataChunk filter_chunk( - const execution::DataChunk& input, - const std::shared_ptr<::common::Expression>& filter_expr, - const std::vector& column_names) { +DataChunk filter_chunk(const DataChunk& input, + const std::shared_ptr<::common::Expression>& filter_expr, + const std::vector& column_names) { if (!filter_expr || input.row_num() == 0) { return input; } @@ -451,15 +443,14 @@ execution::DataChunk filter_chunk( } } - execution::DataChunk filtered = input; + DataChunk filtered = input; filtered.reshuffle(keep_offsets); return filtered; } -execution::DataChunk project_chunk( - const execution::DataChunk& input, - const std::vector& column_names, - const std::vector& project_columns) { +DataChunk project_chunk(const DataChunk& input, + const std::vector& column_names, + const std::vector& project_columns) { if (project_columns.empty()) { return input; } @@ -467,7 +458,7 @@ execution::DataChunk project_chunk( std::unordered_map name_to_index; build_name_to_index(column_names, &name_to_index); - execution::DataChunk projected; + DataChunk projected; for (size_t i = 0; i < project_columns.size(); ++i) { auto iter = name_to_index.find(project_columns[i]); if (iter == name_to_index.end()) { diff --git a/src/utils/io/read/json/json_reader.cc b/src/utils/io/read/json/json_reader.cc index 0a2014977..7bbd1cd8c 100644 --- a/src/utils/io/read/json/json_reader.cc +++ b/src/utils/io/read/json/json_reader.cc @@ -28,9 +28,9 @@ #include #include -#include "neug/execution/common/columns/columns_utils.h" +#include "neug/common/columns/columns_utils.h" +#include "neug/common/types/value.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/loader/loader_utils.h" #include "neug/utils/exception/exception.h" #include "neug/utils/io/read/common/options.h" @@ -95,67 +95,64 @@ std::vector convert_json_array_to_lines(const std::string& path) { return lines; } -execution::Value parse_json_value(const rapidjson::Value& value, - const DataType& data_type) { +Value parse_json_value(const rapidjson::Value& value, + const DataType& data_type) { if (value.IsNull()) { - return execution::Value(data_type); + return Value(data_type); } switch (data_type.id()) { case DataTypeId::kBoolean: if (value.IsBool()) { - return execution::Value::BOOLEAN(value.GetBool()); + return Value::BOOLEAN(value.GetBool()); } if (value.IsString()) { - return execution::Value::BOOLEAN( - execution::ValueConverter::typed_from_string( - value.GetString())); + return Value::BOOLEAN( + ValueConverter::typed_from_string(value.GetString())); } - return execution::Value::BOOLEAN(value.GetBool()); + return Value::BOOLEAN(value.GetBool()); case DataTypeId::kInt32: if (value.IsInt()) { - return execution::Value::INT32(value.GetInt()); + return Value::INT32(value.GetInt()); } - return execution::Value::INT32(static_cast(value.GetInt64())); + return Value::INT32(static_cast(value.GetInt64())); case DataTypeId::kUInt32: - return execution::Value::UINT32(value.GetUint()); + return Value::UINT32(value.GetUint()); case DataTypeId::kInt64: - return execution::Value::INT64(value.GetInt64()); + return Value::INT64(value.GetInt64()); case DataTypeId::kUInt64: - return execution::Value::UINT64(value.GetUint64()); + return Value::UINT64(value.GetUint64()); case DataTypeId::kFloat: - return execution::Value::FLOAT(static_cast(value.GetDouble())); + return Value::FLOAT(static_cast(value.GetDouble())); case DataTypeId::kDouble: - return execution::Value::DOUBLE(value.GetDouble()); + return Value::DOUBLE(value.GetDouble()); case DataTypeId::kDate: { std::string str = value.IsString() ? value.GetString() : rapidjson_stringify(value); - return execution::Value::CreateValue( - execution::ValueConverter::typed_from_string(str)); + return Value::CreateValue( + ValueConverter::typed_from_string(str)); } case DataTypeId::kTimestampMs: { std::string str = value.IsString() ? value.GetString() : rapidjson_stringify(value); - return execution::Value::CreateValue( - execution::ValueConverter::typed_from_string( - str)); + return Value::CreateValue( + ValueConverter::typed_from_string(str)); } case DataTypeId::kInterval: { std::string str = value.IsString() ? value.GetString() : rapidjson_stringify(value); - return execution::Value::CreateValue( - execution::ValueConverter::typed_from_string( - str)); + return Value::CreateValue( + ValueConverter::typed_from_string(str)); } case DataTypeId::kVarchar: if (value.IsString()) { - return execution::Value::STRING(value.GetString()); + return Value::STRING(value.GetString()); } - return execution::Value::STRING(rapidjson_stringify(value)); + return Value::STRING(rapidjson_stringify(value)); default: if (value.IsString()) { - return execution::Value::STRING(value.GetString()); + return Value::STRING(value.GetString()); } - return execution::Value::STRING(rapidjson_stringify(value)); + return Value::STRING(rapidjson_stringify(value)); } } @@ -183,7 +180,7 @@ class JsonChunkSupplier : public IDataChunkSupplier { chunk_size_ = resolve_chunk_size(config_); } - std::shared_ptr GetNextChunk() override { + std::shared_ptr GetNextChunk() override { const auto& selected_names = config_.include_columns.empty() ? config_.column_names : config_.include_columns; @@ -198,10 +195,10 @@ class JsonChunkSupplier : public IDataChunkSupplier { } } - std::vector> builders; + std::vector> builders; builders.reserve(selected_names.size()); for (const auto& type : selected_types) { - builders.push_back(execution::ColumnsUtils::create_builder(type)); + builders.push_back(ColumnsUtils::create_builder(type)); } size_t rows_in_chunk = 0; @@ -245,7 +242,7 @@ class JsonChunkSupplier : public IDataChunkSupplier { return nullptr; } - auto chunk = std::make_shared(); + auto chunk = std::make_shared(); for (size_t col = 0; col < builders.size(); ++col) { chunk->set(static_cast(col), builders[col]->finish()); } diff --git a/src/utils/pb_utils.cc b/src/utils/pb_utils.cc index 5c42a4cd0..9dd92e62f 100644 --- a/src/utils/pb_utils.cc +++ b/src/utils/pb_utils.cc @@ -34,7 +34,7 @@ #include #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/expression/expr.h" #include "neug/generated/proto/plan/common.pb.h" #include "neug/generated/proto/plan/expr.pb.h" @@ -264,7 +264,7 @@ bool data_type_to_property_type(const common::DataType& data_type, bool default_expression_to_value(const DataType& type, const common::Expression& expression, - execution::Value& out_value) { + Value& out_value) { try { auto expr = execution::parse_expression( expression, execution::ContextMeta{}, execution::VarType::kRecord); @@ -280,7 +280,7 @@ bool default_expression_to_value(const DataType& type, return false; } - execution::DataChunk empty_chunk; + DataChunk empty_chunk; out_value = bound_expr->Cast().eval_record( empty_chunk, 0); } catch (const std::exception& e) { @@ -305,22 +305,20 @@ bool default_expression_to_value(const DataType& type, max_length = type.getExtraTypeInfo()->Cast().max_length; } if (max_length <= std::numeric_limits::max()) { - out_value = - execution::Value::VARCHAR(execution::StringValue::Get(out_value), - static_cast(max_length)); + out_value = Value::VARCHAR(StringValue::Get(out_value), + static_cast(max_length)); } } return true; } -neug::result>> -property_defs_to_value( +neug::result>> property_defs_to_value( const google::protobuf::RepeatedPtrField& properties) { - std::vector> result; + std::vector> result; for (const auto& property : properties) { const auto& name = property.name(); - execution::Value default_value(DataType::SQLNULL); + Value default_value(DataType::SQLNULL); DataType type; if (!data_type_to_property_type(property.type(), type)) { RETURN_ERROR(Status(StatusCode::ERR_INVALID_ARGUMENT, diff --git a/src/utils/property/array_column.cc b/src/utils/property/array_column.cc index 2ce272e29..ebe6b629b 100644 --- a/src/utils/property/array_column.cc +++ b/src/utils/property/array_column.cc @@ -35,13 +35,12 @@ std::string MakeChildModuleKey(const std::string& parent_key, return parent_key + "/" + role; } -const std::vector& GetArrayChildren( - const execution::Value& value) { +const std::vector& GetArrayChildren(const Value& value) { if (value.type().id() != DataTypeId::kArray) { THROW_INVALID_ARGUMENT_EXCEPTION( "ArrayColumn expects an ARRAY value, got " + value.type().ToString()); } - return execution::ArrayValue::GetChildren(value); + return ArrayValue::GetChildren(value); } } // namespace @@ -152,7 +151,7 @@ void ArrayColumn::resize(size_t size) { child_column_->resize(size_ * array_size_); } -void ArrayColumn::resize(size_t size, const execution::Value& default_value) { +void ArrayColumn::resize(size_t size, const Value& default_value) { if (size <= size_) { size_ = size; child_column_->resize(size_ * array_size_); @@ -167,8 +166,7 @@ void ArrayColumn::resize(size_t size, const execution::Value& default_value) { } } -void ArrayColumn::set_any(size_t index, const execution::Value& value, - bool insert_safe) { +void ArrayColumn::set_any(size_t index, const Value& value, bool insert_safe) { if (index >= size_) { THROW_RUNTIME_ERROR("ArrayColumn::set_any: index " + std::to_string(index) + " out of range (size=" + std::to_string(size_) + ")"); @@ -185,20 +183,20 @@ void ArrayColumn::set_any(size_t index, const execution::Value& value, } } -execution::Value ArrayColumn::get_any(size_t index) const { +Value ArrayColumn::get_any(size_t index) const { if (index >= size_) { THROW_RUNTIME_ERROR("ArrayColumn::get_value: index " + std::to_string(index) + " out of range (size=" + std::to_string(size_) + ")"); } auto child_type = ArrayType::GetChildType(array_type_); - std::vector values; + std::vector values; values.reserve(array_size_); size_t base = index * array_size_; for (size_t j = 0; j < array_size_; ++j) { values.emplace_back(child_column_->get_any(base + j)); } - return execution::Value::ARRAY(array_type_, std::move(values)); + return Value::ARRAY(array_type_, std::move(values)); } void ArrayColumn::ingest(uint32_t index, OutArchive& arc) { diff --git a/src/utils/property/default_value.cc b/src/utils/property/default_value.cc index aa9dd9c22..3fa39b034 100644 --- a/src/utils/property/default_value.cc +++ b/src/utils/property/default_value.cc @@ -15,47 +15,47 @@ #include "neug/utils/property/default_value.h" #include "neug/common/extra_type_info.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" namespace neug { -execution::Value get_default_value(const DataType& type) { +Value get_default_value(const DataType& type) { switch (type.id()) { case DataTypeId::kEmpty: - return execution::Value(type); + return Value(type); case DataTypeId::kBoolean: - return execution::Value::BOOLEAN(false); + return Value::BOOLEAN(false); case DataTypeId::kInt32: - return execution::Value::INT32(0); + return Value::INT32(0); case DataTypeId::kUInt32: - return execution::Value::UINT32(0); + return Value::UINT32(0); case DataTypeId::kInt64: - return execution::Value::INT64(0); + return Value::INT64(0); case DataTypeId::kUInt64: - return execution::Value::UINT64(0); + return Value::UINT64(0); case DataTypeId::kFloat: - return execution::Value::FLOAT(0.0); + return Value::FLOAT(0.0); case DataTypeId::kDouble: - return execution::Value::DOUBLE(0.0); + return Value::DOUBLE(0.0); case DataTypeId::kVarchar: { int32_t width = type.getExtraTypeInfo() ? type.getExtraTypeInfo()->Cast().max_length : STRING_DEFAULT_MAX_LENGTH; - return execution::Value::VARCHAR("", width); + return Value::VARCHAR("", width); } case DataTypeId::kDate: - return execution::Value::DATE(Date(0)); + return Value::DATE(Date(0)); case DataTypeId::kTimestampMs: - return execution::Value::TIMESTAMPMS(DateTime(0)); + return Value::TIMESTAMPMS(DateTime(0)); case DataTypeId::kInterval: - return execution::Value::INTERVAL(Interval()); + return Value::INTERVAL(Interval()); case DataTypeId::kArray: { auto child_type = ArrayType::GetChildType(type); auto child_default = get_default_value(child_type); uint64_t size = ArrayType::GetNumElements(type); - std::vector values(size, child_default); - return execution::Value::ARRAY(type, std::move(values)); + std::vector values(size, child_default); + return Value::ARRAY(type, std::move(values)); } default: THROW_NOT_SUPPORTED_EXCEPTION( diff --git a/src/utils/property/table.cc b/src/utils/property/table.cc index 57c79c164..58e6143ea 100644 --- a/src/utils/property/table.cc +++ b/src/utils/property/table.cc @@ -98,11 +98,11 @@ void Table::reset_header(const std::vector& col_name) { col_id_map_.swap(new_col_id_map); } -void Table::add_columns( - Checkpoint& ckp, const std::vector& col_names, - const std::vector& col_types, - const std::vector& default_property_values, - size_t capacity, MemoryLevel memory_level) { +void Table::add_columns(Checkpoint& ckp, + const std::vector& col_names, + const std::vector& col_types, + const std::vector& default_property_values, + size_t capacity, MemoryLevel memory_level) { if (default_property_values.size() != col_names.size()) { THROW_RUNTIME_ERROR("default_property_values size mismatch: expected " + std::to_string(col_names.size()) + " but got " + @@ -210,8 +210,8 @@ const ColumnBase* Table::get_column(const std::string& name) const { return nullptr; } -std::vector Table::get_row(size_t row_id) const { - std::vector ret; +std::vector Table::get_row(size_t row_id) const { + std::vector ret; for (auto& ptr : columns_) { ret.push_back(ptr->get_any(row_id)); } @@ -236,7 +236,7 @@ const ColumnBase* Table::get_column_by_id(size_t index) const { size_t Table::col_num() const { return columns_.size(); } -void Table::insert(size_t index, const std::vector& values, +void Table::insert(size_t index, const std::vector& values, bool insert_safe) { assert(values.size() == columns_.size()); CHECK_EQ(values.size(), columns_.size()); @@ -252,8 +252,7 @@ void Table::resize(size_t row_num) { } } -void Table::resize(size_t row_num, - const std::vector& default_values) { +void Table::resize(size_t row_num, const std::vector& default_values) { if (default_values.size() != columns_.size()) { THROW_RUNTIME_ERROR("default_values size mismatch: expected " + std::to_string(columns_.size()) + " but got " + diff --git a/tests/execution/test_runtime_column.cc b/tests/execution/test_runtime_column.cc index 734649d8f..85ff00922 100644 --- a/tests/execution/test_runtime_column.cc +++ b/tests/execution/test_runtime_column.cc @@ -15,11 +15,11 @@ #include #include -#include "neug/execution/common/columns/edge_columns.h" -#include "neug/execution/common/columns/path_columns.h" -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/columns/vertex_columns.h" -#include "neug/execution/common/data_chunk.h" +#include "neug/common/columns/edge_columns.h" +#include "neug/common/columns/path_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/columns/vertex_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/execution/execute/ops/batch/batch_update_utils.h" #include "neug/storages/loader/loader_utils.h" @@ -1430,12 +1430,12 @@ TEST_F(PathColumnTest, OptionalPathColumnForeach) { EXPECT_EQ(collected[0].second, p1); } -class ArrowContextColumnTest : public ::testing::Test { +class ArrowColumnTest : public ::testing::Test { protected: void SetUp() override {} }; -TEST_F(ArrowContextColumnTest, DataChunkSupplierBasic) { +TEST_F(ArrowColumnTest, DataChunkSupplierBasic) { const char* var = std::getenv("TEST_PATH"); std::string test_path = var ? var : "/workspaces/neug/tests"; std::string resource_path = test_path + "/execution/resources"; diff --git a/tests/execution/test_value.cc b/tests/execution/test_value.cc index 10bc279d0..0300dfae8 100644 --- a/tests/execution/test_value.cc +++ b/tests/execution/test_value.cc @@ -14,7 +14,7 @@ */ #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" namespace neug { namespace execution { diff --git a/tests/execution/test_value_column.cc b/tests/execution/test_value_column.cc index 71131c41b..fd452f9bc 100644 --- a/tests/execution/test_value_column.cc +++ b/tests/execution/test_value_column.cc @@ -15,10 +15,10 @@ #include #include -#include "neug/execution/common/columns/array_columns.h" -#include "neug/execution/common/columns/list_columns.h" -#include "neug/execution/common/columns/struct_columns.h" -#include "neug/execution/common/columns/value_columns.h" +#include "neug/common/columns/list_columns.h" +#include "neug/common/columns/struct_columns.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/types/array_columns.h" namespace neug { namespace execution { diff --git a/tests/main/test_query_request.cc b/tests/main/test_query_request.cc index 1c080417f..807dee0af 100644 --- a/tests/main/test_query_request.cc +++ b/tests/main/test_query_request.cc @@ -20,8 +20,8 @@ struct NumericParameterScenario { static std::tuple MakeRequest() { neug::execution::ParamsMap params = { - {"min_id", execution::Value::INT64(100)}, - {"limit", execution::Value::INT32(10)}, + {"min_id", neug::Value::INT64(100)}, + {"limit", neug::Value::INT32(10)}, }; return {"MATCH (n) WHERE n.id > $min_id RETURN n.id", "read", std::move(params)}; @@ -36,7 +36,7 @@ struct ListParameterScenario { static std::tuple MakeRequest() { neug::execution::ParamsMap params; - params.emplace("id_list", execution::Value::LIST(ListStorage())); + params.emplace("id_list", neug::Value::LIST(ListStorage())); return {"MATCH (n) WHERE n.id IN $id_list RETURN n.id", "read", std::move(params)}; } @@ -46,10 +46,10 @@ struct ListParameterScenario { } private: - static std::vector ListStorage() { - static std::vector elements; + static std::vector ListStorage() { + static std::vector elements; for (int i = 1; i <= 5; ++i) { - elements.emplace_back(execution::Value::INT32(i)); + elements.emplace_back(neug::Value::INT32(i)); } return elements; } diff --git a/tests/storage/alter_property_test.cc b/tests/storage/alter_property_test.cc index fc6598f80..0bfce9a36 100644 --- a/tests/storage/alter_property_test.cc +++ b/tests/storage/alter_property_test.cc @@ -23,7 +23,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/csr/csr_base.h" #include "neug/storages/graph/property_graph.h" #include "neug/storages/graph/schema.h" @@ -207,15 +207,15 @@ void testOpenEmptyGraph(std::shared_ptr ckp, { LOG(INFO) << "Create vertex type PERSON"; std::string vertex_label_name = "PERSON"; - std::vector> properties; + std::vector> properties; std::vector primary_keys; primary_keys.emplace_back("id"); properties.emplace_back( - std::make_pair(std::string("id"), execution::Value::INT32(0))); + std::make_pair(std::string("id"), neug::Value::INT32(0))); properties.emplace_back( - std::make_pair(std::string("name"), execution::Value::STRING(""))); + std::make_pair(std::string("name"), neug::Value::STRING(""))); properties.emplace_back( - std::make_pair(std::string("age"), execution::Value::INT32(0))); + std::make_pair(std::string("age"), neug::Value::INT32(0))); // testCreateVertexType(graph, vertex_label_name, properties, primary_keys); CreateVertexTypeParamBuilder builder; auto status = graph.CreateVertexType(builder.VertexLabel(vertex_label_name) @@ -233,9 +233,9 @@ void testOpenEmptyGraph(std::shared_ptr ckp, std::string src_vertex_label = "PERSON"; std::string edge_label_name = "KNOWS"; std::string dst_vertex_label = "PERSON"; - std::vector> edge_properties; + std::vector> edge_properties; edge_properties.emplace_back( - std::make_pair(std::string("weight"), execution::Value::FLOAT(0.0))); + std::make_pair(std::string("weight"), neug::Value::FLOAT(0.0))); CreateEdgeTypeParamBuilder builder; auto status = graph.CreateEdgeType(builder.SrcLabel(src_vertex_label) .DstLabel(dst_vertex_label) @@ -293,10 +293,9 @@ void testOpenEmptyGraph(std::shared_ptr ckp, std::string src_vertex_type = "PERSON"; std::string dst_vertex_type = "PERSON"; std::string edge_type_name = "KNOWS"; - std::vector> add_properties; - add_properties.emplace_back( - std::make_pair(std::string("creationDate"), - execution::Value::TIMESTAMPMS(DateTime(0)))); + std::vector> add_properties; + add_properties.emplace_back(std::make_pair( + std::string("creationDate"), neug::Value::TIMESTAMPMS(DateTime(0)))); AddEdgePropertiesParamBuilder builder; graph.AddEdgeProperties(builder.SrcLabel(src_vertex_type) .DstLabel(dst_vertex_type) diff --git a/tests/storage/test_csr_batch_ops.cc b/tests/storage/test_csr_batch_ops.cc index 81ebd553d..a1caf4f42 100644 --- a/tests/storage/test_csr_batch_ops.cc +++ b/tests/storage/test_csr_batch_ops.cc @@ -1,8 +1,8 @@ #include #include +#include "neug/common/types/value.h" #include "neug/config.h" -#include "neug/execution/common/types/value.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/csr/immutable_csr.h" #include "neug/storages/csr/mutable_csr.h" @@ -52,8 +52,7 @@ class CsrBatchTest : public ::testing::Test { actual; auto view = this->csr->get_generic_view(0); auto ed_accessor = neug::EdgeDataAccessor( - neug::execution::ValueConverter::type().id(), - nullptr); + neug::ValueConverter::type().id(), nullptr); for (neug::vid_t src = 0; src < this->csr->size(); ++src) { auto es = view.get_edges(src); for (auto it = es.begin(); it != es.end(); ++it) { diff --git a/tests/storage/test_csr_stream_ops.cc b/tests/storage/test_csr_stream_ops.cc index 1564857f2..97f47cb9b 100644 --- a/tests/storage/test_csr_stream_ops.cc +++ b/tests/storage/test_csr_stream_ops.cc @@ -61,8 +61,7 @@ class CsrStreamTest : public ::testing::Test { actual; auto view = this->csr->get_generic_view(ts); auto ed_accessor = neug::EdgeDataAccessor( - neug::execution::ValueConverter::type().id(), - nullptr); + neug::ValueConverter::type().id(), nullptr); for (neug::vid_t src = 0; src < this->csr->size(); ++src) { auto es = view.get_edges(src); for (auto it = es.begin(); it != es.end(); ++it) { diff --git a/tests/storage/test_edge_table.cc b/tests/storage/test_edge_table.cc index a2aa7350d..9798136f0 100644 --- a/tests/storage/test_edge_table.cc +++ b/tests/storage/test_edge_table.cc @@ -16,7 +16,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/execution/execute/ops/batch/batch_update_utils.h" #include "neug/storages/allocators.h" #include "neug/storages/checkpoint_manager.h" @@ -96,7 +96,7 @@ class EdgeTableTest : public ::testing::Test { neug::CheckpointManifest(), MemoryLevel::kInMemory); indexer.reserve(num); for (neug::vid_t i = 0; i < num; ++i) { - indexer.insert(neug::execution::Value::INT64(i), i); + indexer.insert(neug::Value::INT64(i), i); } } @@ -125,8 +125,7 @@ class EdgeTableTest : public ::testing::Test { edge_table->EnsureCapacity(src_v_cap, dst_v_cap); } - void BatchInsert( - std::vector>&& chunks) { + void BatchInsert(std::vector>&& chunks) { auto supplier = std::make_shared(std::move(chunks)); edge_table->BatchAddEdges(src_indexer, dst_indexer, supplier); } @@ -217,7 +216,7 @@ class EdgeTableTest : public ::testing::Test { } } - neug::vid_t GetSrcLid(const neug::execution::Value& src_oid) { + neug::vid_t GetSrcLid(const neug::Value& src_oid) { neug::vid_t src_lid; if (!src_indexer.get_index(src_oid, src_lid)) { LOG(FATAL) << "Cannot find src oid " << src_oid.to_string(); @@ -225,7 +224,7 @@ class EdgeTableTest : public ::testing::Test { return src_lid; } - neug::vid_t GetDstLid(const neug::execution::Value& dst_oid) { + neug::vid_t GetDstLid(const neug::Value& dst_oid) { neug::vid_t dst_lid; if (!dst_indexer.get_index(dst_oid, dst_lid)) { LOG(FATAL) << "Cannot find dst oid " << dst_oid.to_string(); @@ -591,10 +590,8 @@ TEST_F(EdgeTableTest, TestDeleteEdge) { size_t delete_count = 0; for (size_t i = 0; i < edge_num; ++i) { if (i % 10 == 0) { - neug::vid_t src_lid = - GetSrcLid(neug::execution::Value::INT64(src_list[i])); - neug::vid_t dst_lid = - GetDstLid(neug::execution::Value::INT64(dst_list[i])); + neug::vid_t src_lid = GetSrcLid(neug::Value::INT64(src_list[i])); + neug::vid_t dst_lid = GetDstLid(neug::Value::INT64(dst_list[i])); auto es = oe_view.get_edges(src_lid); auto is = ie_view.get_edges(dst_lid); for (auto it = es.begin(); it != es.end(); ++it) { @@ -683,9 +680,9 @@ TEST_F(EdgeTableTest, TestBatchAddEdgesBundled) { auto more_dst_list = generate_random_vertices( this->dst_indexer.size(), more_edge_num); auto more_data_list = generate_random_data(more_edge_num); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < more_edge_num; ++i) { - edge_data.push_back({neug::execution::Value::INT32(more_data_list[i])}); + edge_data.push_back({neug::Value::INT32(more_data_list[i])}); } // Insert more edges @@ -731,10 +728,10 @@ TEST_F(EdgeTableTest, TestBatchAddEdgesUnbundled) { this->dst_indexer.size(), more_edge_num); auto more_data_list0 = generate_random_data(more_edge_num); auto more_data_list1 = generate_random_data(more_edge_num); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < more_edge_num; ++i) { - edge_data.push_back({neug::execution::Value::STRING(more_data_list0[i]), - neug::execution::Value::INT32(more_data_list1[i])}); + edge_data.push_back({neug::Value::STRING(more_data_list0[i]), + neug::Value::INT32(more_data_list1[i])}); } // Insert more edges @@ -765,20 +762,20 @@ TEST_F(EdgeTableTest, TestAddEdgeAndDelete) { generate_random_vertices(dst_num, edge_num); for (auto src_oid : src_oids) { neug::vid_t src_lid = - this->src_indexer.insert(neug::execution::Value::INT64(src_oid), true); + this->src_indexer.insert(neug::Value::INT64(src_oid), true); src_lids.push_back(src_lid); } for (auto dst_oid : dst_oids) { neug::vid_t dst_lid = - this->dst_indexer.insert(neug::execution::Value::INT64(dst_oid), true); + this->dst_indexer.insert(neug::Value::INT64(dst_oid), true); dst_lids.push_back(dst_lid); } this->edge_table->EnsureCapacity(this->src_indexer.size(), this->dst_indexer.size()); this->ExpectBundledStats(0); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < src_lids.size(); ++i) { - edge_data.push_back({neug::execution::Value::INT32(static_cast(i))}); + edge_data.push_back({neug::Value::INT32(static_cast(i))}); } neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); @@ -884,21 +881,21 @@ TEST_F(EdgeTableTest, TestAddEdgeDeleteUnbundled) { generate_random_vertices(dst_num, edge_num); for (auto src_oid : src_oids) { neug::vid_t src_lid = - this->src_indexer.insert(neug::execution::Value::INT64(src_oid), true); + this->src_indexer.insert(neug::Value::INT64(src_oid), true); src_lids.push_back(src_lid); } for (auto dst_oid : dst_oids) { neug::vid_t dst_lid = - this->dst_indexer.insert(neug::execution::Value::INT64(dst_oid), true); + this->dst_indexer.insert(neug::Value::INT64(dst_oid), true); dst_lids.push_back(dst_lid); } this->edge_table->EnsureCapacity(this->src_indexer.size(), this->dst_indexer.size()); this->ExpectUnbundledStats(0, 0); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < src_lids.size(); ++i) { - edge_data.push_back({neug::execution::Value::STRING("edge_data"), - neug::execution::Value::INT32(static_cast(i))}); + edge_data.push_back({neug::Value::STRING("edge_data"), + neug::Value::INT32(static_cast(i))}); } neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); @@ -971,20 +968,20 @@ TEST_F(EdgeTableTest, TestEdgeTableCompaction) { generate_random_vertices(dst_num, edge_num); for (auto src_oid : src_oids) { neug::vid_t src_lid = - this->src_indexer.insert(neug::execution::Value::INT64(src_oid), true); + this->src_indexer.insert(neug::Value::INT64(src_oid), true); src_lids.push_back(src_lid); } for (auto dst_oid : dst_oids) { neug::vid_t dst_lid = - this->dst_indexer.insert(neug::execution::Value::INT64(dst_oid), true); + this->dst_indexer.insert(neug::Value::INT64(dst_oid), true); dst_lids.push_back(dst_lid); } this->edge_table->EnsureCapacity(this->src_indexer.size(), this->dst_indexer.size()); this->ExpectBundledStats(0); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < src_lids.size(); ++i) { - edge_data.push_back({neug::execution::Value::INT32(static_cast(i))}); + edge_data.push_back({neug::Value::INT32(static_cast(i))}); } neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); @@ -1046,21 +1043,21 @@ TEST_F(EdgeTableTest, TestUpdateEdgeData) { generate_random_vertices(dst_num, edge_num); for (auto src_oid : src_oids) { neug::vid_t src_lid = - this->src_indexer.insert(neug::execution::Value::INT64(src_oid), true); + this->src_indexer.insert(neug::Value::INT64(src_oid), true); src_lids.push_back(src_lid); } for (auto dst_oid : dst_oids) { neug::vid_t dst_lid = - this->dst_indexer.insert(neug::execution::Value::INT64(dst_oid), true); + this->dst_indexer.insert(neug::Value::INT64(dst_oid), true); dst_lids.push_back(dst_lid); } this->edge_table->EnsureCapacity(this->src_indexer.size(), this->dst_indexer.size()); this->ExpectUnbundledStats(0, 0); - std::vector> edge_data; + std::vector> edge_data; for (size_t i = 0; i < src_lids.size(); ++i) { - edge_data.push_back({neug::execution::Value::STRING("old_data"), - neug::execution::Value::INT32(static_cast(0))}); + edge_data.push_back({neug::Value::STRING("old_data"), + neug::Value::INT32(static_cast(0))}); } this->edge_table->EnsureCapacity(edge_data.size()); @@ -1071,9 +1068,9 @@ TEST_F(EdgeTableTest, TestUpdateEdgeData) { allocator, false); } this->ExpectUnbundledStats(edge_num, 4096); - std::vector new_data = { - neug::execution::Value::STRING(std::string("new_data")), - neug::execution::Value::INT32(static_cast(1))}; + std::vector new_data = { + neug::Value::STRING(std::string("new_data")), + neug::Value::INT32(static_cast(1))}; auto oe_view = this->edge_table->get_outgoing_view(neug::MAX_TIMESTAMP); auto ie_view = this->edge_table->get_incoming_view(neug::MAX_TIMESTAMP); auto ed_accessor_0 = this->edge_table->get_edge_data_accessor(0); @@ -1127,11 +1124,11 @@ TEST_F(EdgeTableTest, TestAddPropertiesTransitionFromEmptyToBundledUnbundled) { schema_.AddEdgeProperties("person", "comment", "create0", {"weight"}, {neug::DataTypeId::kInt32}, - {neug::execution::Value::INT32(7)}); + {neug::Value::INT32(7)}); this->edge_table->SetEdgeSchema( schema_.get_edge_schema(src_label_, dst_label_, edge_label_empty_)); this->edge_table->AddProperties(*ckp, {"weight"}, {neug::DataTypeId::kInt32}, - {neug::execution::Value::INT32(7)}); + {neug::Value::INT32(7)}); this->ExpectBundledStats(endpoints.size()); std::vector srcs, dsts; @@ -1144,14 +1141,14 @@ TEST_F(EdgeTableTest, TestAddPropertiesTransitionFromEmptyToBundledUnbundled) { EXPECT_EQ(weight, 7); } - schema_.AddEdgeProperties( - "person", "comment", "create0", {"tag"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("new-tag"))}); + schema_.AddEdgeProperties("person", "comment", "create0", {"tag"}, + {neug::DataTypeId::kVarchar}, + {neug::Value::STRING(std::string("new-tag"))}); this->edge_table->SetEdgeSchema( schema_.get_edge_schema(src_label_, dst_label_, edge_label_empty_)); this->edge_table->AddProperties( *ckp, {"tag"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("new-tag"))}); + {neug::Value::STRING(std::string("new-tag"))}); this->ExpectUnbundledStats(endpoints.size(), 4096); std::vector weights_after; @@ -1185,17 +1182,15 @@ TEST_F(EdgeTableTest, TestAddStringPropertyTransitionFromEmptyToUnbundled) { schema_.get_edge_schema(src_label_, dst_label_, edge_label_empty_)); schema_.get_edge_schema(src_label_, dst_label_, edge_label_empty_) ->add_properties({"tag"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("seed"))}); - this->edge_table->AddProperties( - *ckp, {"tag"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("seed"))}); + {neug::Value::STRING(std::string("seed"))}); + this->edge_table->AddProperties(*ckp, {"tag"}, {neug::DataTypeId::kVarchar}, + {neug::Value::STRING(std::string("seed"))}); schema_.get_edge_schema(src_label_, dst_label_, edge_label_empty_) - ->add_properties( - {"desc"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("unknown"))}); + ->add_properties({"desc"}, {neug::DataTypeId::kVarchar}, + {neug::Value::STRING(std::string("unknown"))}); this->edge_table->AddProperties( *ckp, {"desc"}, {neug::DataTypeId::kVarchar}, - {neug::execution::Value::STRING(std::string("unknown"))}); + {neug::Value::STRING(std::string("unknown"))}); this->ExpectUnbundledStats(src_list.size(), 4096); std::vector tags, descs; @@ -1225,13 +1220,12 @@ TEST_F(EdgeTableTest, {0, 1, "a", 11}, {1, 2, "b", 22}, {2, 3, "c", 33}}; neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); for (const auto& [src_oid, dst_oid, data0, data1] : input) { - auto src_lid = this->GetSrcLid(neug::execution::Value::INT64(src_oid)); - auto dst_lid = this->GetDstLid(neug::execution::Value::INT64(dst_oid)); + auto src_lid = this->GetSrcLid(neug::Value::INT64(src_oid)); + auto dst_lid = this->GetDstLid(neug::Value::INT64(dst_oid)); this->edge_table->AddEdge( src_lid, dst_lid, - {neug::execution::Value::STRING(std::string(data0)), - neug::execution::Value::INT32(data1)}, - 0, allocator, false); + {neug::Value::STRING(std::string(data0)), neug::Value::INT32(data1)}, 0, + allocator, false); } this->ExpectUnbundledStats(input.size(), 4096); @@ -1273,8 +1267,8 @@ TEST_F(EdgeTableTest, ASSERT_EQ(dsts.size(), input.size()); { - auto src_lid = this->GetSrcLid(neug::execution::Value::INT64(3)); - auto dst_lid = this->GetDstLid(neug::execution::Value::INT64(0)); + auto src_lid = this->GetSrcLid(neug::Value::INT64(3)); + auto dst_lid = this->GetDstLid(neug::Value::INT64(0)); this->edge_table->AddEdge(src_lid, dst_lid, {}, 0, allocator, false); } this->ExpectBundledStats(input.size() + 1); @@ -1298,12 +1292,12 @@ TEST_F(EdgeTableTest, TestDeletePropertiesTransitionFromUnbundledToBundled) { {0, 1, "a", 11}, {1, 2, "b", 22}, {2, 3, "c", 33}}; neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); for (const auto& [src_oid, dst_oid, data0, data1] : input) { - auto src_lid = this->GetSrcLid(neug::execution::Value::INT64(src_oid)); - auto dst_lid = this->GetDstLid(neug::execution::Value::INT64(dst_oid)); - this->edge_table->AddEdge(src_lid, dst_lid, - {neug::execution::Value::STRING(data0), - neug::execution::Value::INT32(data1)}, - 0, allocator, false); + auto src_lid = this->GetSrcLid(neug::Value::INT64(src_oid)); + auto dst_lid = this->GetDstLid(neug::Value::INT64(dst_oid)); + this->edge_table->AddEdge( + src_lid, dst_lid, + {neug::Value::STRING(data0), neug::Value::INT32(data1)}, 0, allocator, + false); } this->ExpectUnbundledStats(input.size(), 4096); @@ -1338,11 +1332,10 @@ TEST_F(EdgeTableTest, TestDeletePropertiesTransitionFromUnbundledToBundled) { this->ExpectBundledStats(input.size()); { - auto src_lid = this->GetSrcLid(neug::execution::Value::INT64(3)); - auto dst_lid = this->GetDstLid(neug::execution::Value::INT64(0)); - this->edge_table->AddEdge(src_lid, dst_lid, - {neug::execution::Value::INT32(44)}, 0, allocator, - false); + auto src_lid = this->GetSrcLid(neug::Value::INT64(3)); + auto dst_lid = this->GetDstLid(neug::Value::INT64(0)); + this->edge_table->AddEdge(src_lid, dst_lid, {neug::Value::INT32(44)}, 0, + allocator, false); } this->ExpectBundledStats(input.size() + 1); } @@ -1360,23 +1353,22 @@ TEST_F(EdgeTableTest, TestAddAndDeletePropertiesStayUnbundled) { {0, 1, "a", 11}, {1, 2, "b", 22}, {2, 3, "c", 33}}; neug::Allocator allocator(neug::MemoryLevel::kInMemory, allocator_dir_); for (const auto& [src_oid, dst_oid, data0, data1] : input) { - auto src_lid = this->GetSrcLid(neug::execution::Value::INT64(src_oid)); - auto dst_lid = this->GetDstLid(neug::execution::Value::INT64(dst_oid)); + auto src_lid = this->GetSrcLid(neug::Value::INT64(src_oid)); + auto dst_lid = this->GetDstLid(neug::Value::INT64(dst_oid)); this->edge_table->AddEdge( src_lid, dst_lid, - {neug::execution::Value::STRING(std::string(data0)), - neug::execution::Value::INT32(data1)}, - 0, allocator, false); + {neug::Value::STRING(std::string(data0)), neug::Value::INT32(data1)}, 0, + allocator, false); } this->ExpectUnbundledStats(input.size(), 4096); schema_.AddEdgeProperties("person", "comment", "create3", {"score"}, {neug::DataTypeId::kInt32}, - {neug::execution::Value::INT32(99)}); + {neug::Value::INT32(99)}); this->edge_table->SetEdgeSchema( schema_.get_edge_schema(src_label_, dst_label_, edge_label_str_int_)); this->edge_table->AddProperties(*ckp, {"score"}, {neug::DataTypeId::kInt32}, - {neug::execution::Value::INT32(99)}); + {neug::Value::INT32(99)}); this->ExpectUnbundledStats(input.size(), 4096); std::vector score; @@ -1515,7 +1507,7 @@ TYPED_TEST(EdgeTableToolsTest, TestBatchAddEdges) { neug::CheckpointManifest(), MemoryLevel::kInMemory); indexer.reserve(10); for (uint32_t i = 0; i < 10; i++) { - auto oid = neug::execution::Value::UINT32(i); + auto oid = neug::Value::UINT32(i); indexer.insert(oid, false); } @@ -1566,7 +1558,7 @@ TYPED_TEST(EdgeTableToolsTest, TestAddProperties) { neug::CheckpointManifest(), MemoryLevel::kInMemory); indexer.reserve(10); for (uint32_t i = 0; i < 10; i++) { - auto oid = neug::execution::Value::UINT32(i); + auto oid = neug::Value::UINT32(i); indexer.insert(oid, false); } diff --git a/tests/storage/test_graph_snapshot_store_concurrency.cc b/tests/storage/test_graph_snapshot_store_concurrency.cc index 6f612cfef..1e59c22c2 100644 --- a/tests/storage/test_graph_snapshot_store_concurrency.cc +++ b/tests/storage/test_graph_snapshot_store_concurrency.cc @@ -68,7 +68,7 @@ class GraphSnapshotStoreConcurrencyTest : public ::testing::Test { CreateVertexTypeParamBuilder person_builder; auto status = initial_pg_->CreateVertexType( person_builder.VertexLabel("person") - .AddProperty("id", execution::Value::INT64(0)) + .AddProperty("id", neug::Value::INT64(0)) .AddPrimaryKeyName("id") .Build()); ASSERT_TRUE(status.ok()); @@ -291,11 +291,11 @@ TEST_F(GraphSnapshotStoreConcurrencyTest, CowPublishIsVisibleToNewReaders) { // Clone and add a new vertex type to the COW copy. auto cow_pg = initial_pg_->Clone(); CreateVertexTypeParamBuilder builder; - auto status = cow_pg->CreateVertexType( - builder.VertexLabel("company") - .AddProperty("name", execution::Value::STRING("")) - .AddPrimaryKeyName("name") - .Build()); + auto status = + cow_pg->CreateVertexType(builder.VertexLabel("company") + .AddProperty("name", neug::Value::STRING("")) + .AddPrimaryKeyName("name") + .Build()); ASSERT_TRUE(status.ok()); // Publish the mutated snapshot. @@ -341,8 +341,7 @@ TEST_F(GraphSnapshotStoreConcurrencyTest, AbortReleasesSlotWithoutLeak) { TEST_F(GraphSnapshotStoreConcurrencyTest, CowIsolationAfterCloneMutatePublish) { // Phase 1: seed the initial snapshot with a vertex. vid_t vid0 = 0; - auto status = - initial_pg_->AddVertex(0, execution::Value::INT64(1), {}, vid0, 1); + auto status = initial_pg_->AddVertex(0, neug::Value::INT64(1), {}, vid0, 1); ASSERT_TRUE(status.ok()); ASSERT_EQ(initial_pg_->VertexNum(0, MAX_TIMESTAMP), 1u); @@ -356,7 +355,7 @@ TEST_F(GraphSnapshotStoreConcurrencyTest, CowIsolationAfterCloneMutatePublish) { vt1.get_table().DetachAllColumns(*cow1->checkpoint_ptr(), cow1->memory_level()); vid_t vid1 = 0; - status = cow1->AddVertex(0, execution::Value::INT64(2), {}, vid1, 2); + status = cow1->AddVertex(0, neug::Value::INT64(2), {}, vid1, 2); ASSERT_TRUE(status.ok()); ASSERT_EQ(cow1->VertexNum(0, MAX_TIMESTAMP), 2u); @@ -372,7 +371,7 @@ TEST_F(GraphSnapshotStoreConcurrencyTest, CowIsolationAfterCloneMutatePublish) { vt2.get_table().DetachAllColumns(*cow2->checkpoint_ptr(), cow2->memory_level()); vid_t vid2 = 0; - status = cow2->AddVertex(0, execution::Value::INT64(3), {}, vid2, 3); + status = cow2->AddVertex(0, neug::Value::INT64(3), {}, vid2, 3); ASSERT_TRUE(status.ok()); // cow2 sees all three vertices. diff --git a/tests/storage/test_graph_view.cc b/tests/storage/test_graph_view.cc index 0c1ff5fa1..2a45e7be5 100644 --- a/tests/storage/test_graph_view.cc +++ b/tests/storage/test_graph_view.cc @@ -54,43 +54,40 @@ class GraphViewTest : public ::testing::Test { // Create vertex type: person with id as primary key and name as property CreateVertexTypeParamBuilder person_builder; - ASSERT_TRUE(graph_ - ->CreateVertexType( - person_builder.VertexLabel("person") - .AddProperty("id", execution::Value::INT64(0)) - .AddProperty("name", execution::Value::STRING("")) - .AddPrimaryKeyName("id") - .Build()) - .ok()); - - // Create edge type: knows - CreateEdgeTypeParamBuilder knows_builder; ASSERT_TRUE( graph_ - ->CreateEdgeType( - knows_builder.SrcLabel("person") - .DstLabel("person") - .EdgeLabel("knows") - .AddProperty("weight", execution::Value::DOUBLE(0.0)) - .Build()) + ->CreateVertexType(person_builder.VertexLabel("person") + .AddProperty("id", neug::Value::INT64(0)) + .AddProperty("name", neug::Value::STRING("")) + .AddPrimaryKeyName("id") + .Build()) .ok()); + // Create edge type: knows + CreateEdgeTypeParamBuilder knows_builder; + ASSERT_TRUE(graph_ + ->CreateEdgeType( + knows_builder.SrcLabel("person") + .DstLabel("person") + .EdgeLabel("knows") + .AddProperty("weight", neug::Value::DOUBLE(0.0)) + .Build()) + .ok()); + // Add vertices label_t person_label = graph_->schema().get_vertex_label_id("person"); vid_t vid1, vid2, vid3; ASSERT_TRUE(graph_ - ->AddVertex(person_label, execution::Value::INT64(1), - {execution::Value::STRING("Alice")}, vid1, 0, - false) + ->AddVertex(person_label, neug::Value::INT64(1), + {neug::Value::STRING("Alice")}, vid1, 0, false) .ok()); ASSERT_TRUE(graph_ - ->AddVertex(person_label, execution::Value::INT64(2), - {execution::Value::STRING("Bob")}, vid2, 0, - false) + ->AddVertex(person_label, neug::Value::INT64(2), + {neug::Value::STRING("Bob")}, vid2, 0, false) .ok()); ASSERT_TRUE(graph_ - ->AddVertex(person_label, execution::Value::INT64(3), - {execution::Value::STRING("Charlie")}, vid3, 0, + ->AddVertex(person_label, neug::Value::INT64(3), + {neug::Value::STRING("Charlie")}, vid3, 0, false) .ok()); @@ -100,12 +97,12 @@ class GraphViewTest : public ::testing::Test { const void* edge_prop = nullptr; ASSERT_TRUE(graph_ ->AddEdge(person_label, vid1, person_label, vid2, - knows_label, {execution::Value::DOUBLE(0.5)}, 0, + knows_label, {neug::Value::DOUBLE(0.5)}, 0, *alloc_, oe_offset, edge_prop, false) .ok()); ASSERT_TRUE(graph_ ->AddEdge(person_label, vid2, person_label, vid3, - knows_label, {execution::Value::DOUBLE(0.7)}, 0, + knows_label, {neug::Value::DOUBLE(0.7)}, 0, *alloc_, oe_offset, edge_prop, false) .ok()); } @@ -130,11 +127,10 @@ TEST_F(GraphViewTest, GetLid) { label_t person_label = view.schema().get_vertex_label_id("person"); vid_t lid; - EXPECT_TRUE(view.get_lid(person_label, execution::Value::INT64(1), lid, 0)); - EXPECT_TRUE(view.get_lid(person_label, execution::Value::INT64(2), lid, 0)); - EXPECT_TRUE(view.get_lid(person_label, execution::Value::INT64(3), lid, 0)); - EXPECT_FALSE( - view.get_lid(person_label, execution::Value::INT64(999), lid, 0)); + EXPECT_TRUE(view.get_lid(person_label, neug::Value::INT64(1), lid, 0)); + EXPECT_TRUE(view.get_lid(person_label, neug::Value::INT64(2), lid, 0)); + EXPECT_TRUE(view.get_lid(person_label, neug::Value::INT64(3), lid, 0)); + EXPECT_FALSE(view.get_lid(person_label, neug::Value::INT64(999), lid, 0)); } TEST_F(GraphViewTest, GetOid) { diff --git a/tests/storage/test_property_graph.cc b/tests/storage/test_property_graph.cc index 83ad97c0e..cd087e08a 100644 --- a/tests/storage/test_property_graph.cc +++ b/tests/storage/test_property_graph.cc @@ -15,7 +15,7 @@ #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/graph/property_graph.h" #include "unittest/utils.h" @@ -53,32 +53,31 @@ class PropertyGraphTest : public ::testing::Test { EXPECT_TRUE(graph_ ->CreateVertexType( person_builder.VertexLabel("person") - .AddProperty("id", execution::Value::INT64(0)) - .AddProperty("name", execution::Value::STRING("")) - .AddProperty("age", execution::Value::INT32(0)) - .AddProperty("score", execution::Value::DOUBLE(0.0)) + .AddProperty("id", neug::Value::INT64(0)) + .AddProperty("name", neug::Value::STRING("")) + .AddProperty("age", neug::Value::INT32(0)) + .AddProperty("score", neug::Value::DOUBLE(0.0)) .AddPrimaryKeyName("id") .Build()) .ok()); CreateVertexTypeParamBuilder company_builder; - EXPECT_TRUE(graph_ - ->CreateVertexType( - company_builder.VertexLabel("company") - .AddProperty("id", execution::Value::INT64(0)) - .AddProperty("name", execution::Value::STRING("")) - .AddPrimaryKeyName("id") - .Build()) - .ok()); - CreateEdgeTypeParamBuilder knows_builder; EXPECT_TRUE( graph_ - ->CreateEdgeType( - knows_builder.SrcLabel("person") - .DstLabel("person") - .EdgeLabel("knows") - .AddProperty("weight", execution::Value::DOUBLE(0.0)) - .Build()) + ->CreateVertexType(company_builder.VertexLabel("company") + .AddProperty("id", neug::Value::INT64(0)) + .AddProperty("name", neug::Value::STRING("")) + .AddPrimaryKeyName("id") + .Build()) .ok()); + CreateEdgeTypeParamBuilder knows_builder; + EXPECT_TRUE(graph_ + ->CreateEdgeType( + knows_builder.SrcLabel("person") + .DstLabel("person") + .EdgeLabel("knows") + .AddProperty("weight", neug::Value::DOUBLE(0.0)) + .Build()) + .ok()); } }; @@ -88,20 +87,20 @@ TEST_F(PropertyGraphTest, TestOpenAndBulkInsert) { label_t knows_label = graph_->schema().get_edge_label_id("knows"); vid_t vid1, vid2; - EXPECT_TRUE(graph_ - ->AddVertex(person_label, execution::Value::INT64(1), - {execution::Value::STRING("Alice"), - execution::Value::INT32(30), - execution::Value::DOUBLE(88.5)}, - vid1, 0) - .ok()); - EXPECT_TRUE(graph_ - ->AddVertex(person_label, execution::Value::INT64(2), - {execution::Value::STRING("Bob"), - execution::Value::INT32(25), - execution::Value::DOUBLE(92.0)}, - vid2, 0) - .ok()); + EXPECT_TRUE( + graph_ + ->AddVertex(person_label, neug::Value::INT64(1), + {neug::Value::STRING("Alice"), neug::Value::INT32(30), + neug::Value::DOUBLE(88.5)}, + vid1, 0) + .ok()); + EXPECT_TRUE( + graph_ + ->AddVertex(person_label, neug::Value::INT64(2), + {neug::Value::STRING("Bob"), neug::Value::INT32(25), + neug::Value::DOUBLE(92.0)}, + vid2, 0) + .ok()); auto id_column = graph_->GetVertexPropertyColumn(person_label, "id"); EXPECT_TRUE(id_column); EXPECT_EQ(id_column->get_any(vid1).GetValue(), 1); @@ -110,28 +109,28 @@ TEST_F(PropertyGraphTest, TestOpenAndBulkInsert) { // By default, we will reserve 4096 slots for each vertex label. for (size_t i = 3; i <= 4096; ++i) { vid_t vid; - graph_->AddVertex(person_label, execution::Value::INT64(i), - {execution::Value::STRING("User" + std::to_string(i)), - execution::Value::INT32(20 + (i % 10)), - execution::Value::DOUBLE(80.0 + (i % 20))}, + graph_->AddVertex(person_label, neug::Value::INT64(i), + {neug::Value::STRING("User" + std::to_string(i)), + neug::Value::INT32(20 + (i % 10)), + neug::Value::DOUBLE(80.0 + (i % 20))}, vid, 0); } EXPECT_EQ(graph_->VertexNum(person_label), 4096); vid_t vid4097; - EXPECT_FALSE(graph_ - ->AddVertex(person_label, execution::Value::INT64(4097), - {execution::Value::STRING("User4097"), - execution::Value::INT32(27), - execution::Value::DOUBLE(85.0)}, - vid4097, 0) - .ok()); + EXPECT_FALSE( + graph_ + ->AddVertex(person_label, neug::Value::INT64(4097), + {neug::Value::STRING("User4097"), neug::Value::INT32(27), + neug::Value::DOUBLE(85.0)}, + vid4097, 0) + .ok()); Allocator allocator(MemoryLevel::kInMemory, ""); for (vid_t i = 0; i < 4094; ++i) { int32_t oe_offset = 0; const void* prop = nullptr; graph_->AddEdge(person_label, i, person_label, i + 1, knows_label, - {execution::Value::DOUBLE(1.0)}, MAX_TIMESTAMP, allocator, + {neug::Value::DOUBLE(1.0)}, MAX_TIMESTAMP, allocator, oe_offset, prop); } { @@ -139,7 +138,7 @@ TEST_F(PropertyGraphTest, TestOpenAndBulkInsert) { const void* prop = nullptr; EXPECT_FALSE(graph_ ->AddEdge(person_label, 4095, person_label, 4096, - knows_label, {execution::Value::DOUBLE(1.0)}, + knows_label, {neug::Value::DOUBLE(1.0)}, MAX_TIMESTAMP, allocator, oe_offset, prop) .ok()); } diff --git a/tests/storage/test_temporary_graph.cc b/tests/storage/test_temporary_graph.cc index 24fcfa013..480f0b054 100644 --- a/tests/storage/test_temporary_graph.cc +++ b/tests/storage/test_temporary_graph.cc @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/connection.h" #include "neug/main/neug_db.h" #include "neug/storages/checkpoint_manager.h" @@ -37,7 +37,7 @@ using neug::label_t; using neug::MemoryLevel; using neug::PropertyGraph; using neug::Schema; -using neug::execution::Value; +using neug::Value; // ============================================================================ // Part 1: Schema layer temporary marking tests diff --git a/tests/storage/test_vertex_table.cc b/tests/storage/test_vertex_table.cc index d91796e74..a6b4adeb7 100644 --- a/tests/storage/test_vertex_table.cc +++ b/tests/storage/test_vertex_table.cc @@ -21,7 +21,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/neug_db.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/graph/schema.h" @@ -49,12 +49,10 @@ class VertexTableTest : public ::testing::Test { property_names_ = {"name", "age", "score"}; property_types_ = {neug::DataTypeId::kVarchar, neug::DataTypeId::kInt32, neug::DataTypeId::kDouble}; - property_values_ = {neug::execution::Value::STRING("Alice"), - neug::execution::Value::INT32(30), - neug::execution::Value::DOUBLE(88.5)}; - default_prop_values_ = {neug::execution::Value::STRING(""), - neug::execution::Value::INT32(0), - neug::execution::Value::DOUBLE(0.0)}; + property_values_ = {neug::Value::STRING("Alice"), neug::Value::INT32(30), + neug::Value::DOUBLE(88.5)}; + default_prop_values_ = {neug::Value::STRING(""), neug::Value::INT32(0), + neug::Value::DOUBLE(0.0)}; vertex_count_ = 1000000; schema_.AddVertexLabel(v_label_name_, property_types_, property_names_, {std::make_tuple(pk_type_, "id", 0)}, 4096, "", @@ -72,7 +70,7 @@ class VertexTableTest : public ::testing::Test { } } - std::vector> generate_data_chunks( + std::vector> generate_data_chunks( size_t num_vertices) { std::vector oid_values; std::vector name_values; @@ -98,8 +96,8 @@ class VertexTableTest : public ::testing::Test { neug::DataTypeId pk_type_; std::vector property_names_; std::vector property_types_; - std::vector property_values_; - std::vector default_prop_values_; + std::vector property_values_; + std::vector default_prop_values_; std::mt19937 generator_; neug::Schema schema_; neug::label_t v_label_id_ = 0; @@ -115,9 +113,9 @@ TEST_F(VertexTableTest, VertexTableBasicOps) { table.EnsureCapacity(vertex_count_); neug::vid_t lid1, lid2, lid3; - auto oid1 = neug::execution::Value::INT64(1); - auto oid2 = neug::execution::Value::INT64(2); - auto oid3 = neug::execution::Value::INT64(3); + auto oid1 = neug::Value::INT64(1); + auto oid2 = neug::Value::INT64(2); + auto oid3 = neug::Value::INT64(3); EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 1, false)); EXPECT_TRUE(table.AddVertex(oid2, property_values_, lid2, 2, false)); EXPECT_TRUE(table.AddVertex(oid3, property_values_, lid3, 3, false)); @@ -163,9 +161,9 @@ TEST_F(VertexTableTest, VertexTableDumpAndReload) { table.EnsureCapacity(vertex_count_); neug::vid_t lid1, lid2, lid3; - auto oid1 = neug::execution::Value::INT64(1); - auto oid2 = neug::execution::Value::INT64(2); - auto oid3 = neug::execution::Value::INT64(3); + auto oid1 = neug::Value::INT64(1); + auto oid2 = neug::Value::INT64(2); + auto oid3 = neug::Value::INT64(3); EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 1, false)); EXPECT_TRUE(table.AddVertex(oid2, property_values_, lid2, 2, false)); EXPECT_TRUE(table.AddVertex(oid3, property_values_, lid3, 3, false)); @@ -189,7 +187,7 @@ TEST_F(VertexTableTest, VertexTableAddAndDeleteAndReload) { auto ckp = make_checkpoint(Workspace()); neug::vid_t lid1, lid2, lid3; - neug::execution::Value oid1, oid2, oid3; + neug::Value oid1, oid2, oid3; neug::CheckpointManifest desc; { neug::VertexTable table(schema_.get_vertex_schema(v_label_id_)); @@ -197,9 +195,9 @@ TEST_F(VertexTableTest, VertexTableAddAndDeleteAndReload) { memory_level_); table.EnsureCapacity(vertex_count_); - oid1 = neug::execution::Value::INT64(1); - oid2 = neug::execution::Value::INT64(2); - oid3 = neug::execution::Value::INT64(3); + oid1 = neug::Value::INT64(1); + oid2 = neug::Value::INT64(2); + oid3 = neug::Value::INT64(3); EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 1, false)); EXPECT_TRUE(table.AddVertex(oid2, property_values_, lid2, 2, false)); EXPECT_TRUE(table.AddVertex(oid3, property_values_, lid3, 3, false)); @@ -250,9 +248,9 @@ TEST_F(VertexTableTest, AddVertexBasic) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid1 = neug::execution::Value::INT64(100); - auto oid2 = neug::execution::Value::INT64(200); - auto oid3 = neug::execution::Value::INT64(300); + auto oid1 = neug::Value::INT64(100); + auto oid2 = neug::Value::INT64(200); + auto oid3 = neug::Value::INT64(300); neug::vid_t lid1, lid2, lid3; EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 0, false)); EXPECT_TRUE(table.AddVertex(oid2, property_values_, lid2, 1, false)); @@ -291,16 +289,16 @@ TEST_F(VertexTableTest, AddVertex) { // AddVertex must return false on an opened table whose capacity is still 0 // (no EnsureCapacity call yet). neug::vid_t tmp_vid; - EXPECT_FALSE(table.AddVertex(neug::execution::Value::INT64(1), - property_values_, tmp_vid, 0, false)); + EXPECT_FALSE(table.AddVertex(neug::Value::INT64(1), property_values_, tmp_vid, + 0, false)); - std::vector oids; + std::vector oids; std::vector lids; table.EnsureCapacity(100); lids.resize(100); for (int64_t i = 0; i < 100; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); oids.push_back(oid); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], i % 10, false)); } @@ -323,9 +321,9 @@ TEST_F(VertexTableTest, DeleteVertexBasic) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid1 = neug::execution::Value::INT64(1); - auto oid2 = neug::execution::Value::INT64(2); - auto oid3 = neug::execution::Value::INT64(3); + auto oid1 = neug::Value::INT64(1); + auto oid2 = neug::Value::INT64(2); + auto oid3 = neug::Value::INT64(3); neug::vid_t lid1, lid2, lid3; EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 1, false)); @@ -356,7 +354,7 @@ TEST_F(VertexTableTest, RevertDeleteVertexBasic) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid1 = neug::execution::Value::INT64(1); + auto oid1 = neug::Value::INT64(1); neug::vid_t lid1; EXPECT_TRUE(table.AddVertex(oid1, property_values_, lid1, 1, false)); @@ -386,12 +384,12 @@ TEST_F(VertexTableTest, AddDeleteRevertCombination) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - std::vector oids; + std::vector oids; std::vector lids; lids.resize(10); for (int64_t i = 0; i < 10; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); oids.push_back(oid); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], i, false)); } @@ -431,7 +429,7 @@ TEST_F(VertexTableTest, MultipleDeletesAndReverts) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid = neug::execution::Value::INT64(42); + auto oid = neug::Value::INT64(42); neug::vid_t lid; EXPECT_TRUE(table.AddVertex(oid, property_values_, lid, 1, false)); @@ -471,7 +469,7 @@ TEST_F(VertexTableTest, MixedAddVertexAndAddVertexSafe) { // Add using both methods alternately for (int64_t i = 0; i < 20; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], i, false)); } @@ -490,9 +488,9 @@ TEST_F(VertexTableTest, TemporalVisibilityComplex) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid1 = neug::execution::Value::INT64(1); - auto oid2 = neug::execution::Value::INT64(2); - auto oid3 = neug::execution::Value::INT64(3); + auto oid1 = neug::Value::INT64(1); + auto oid2 = neug::Value::INT64(2); + auto oid3 = neug::Value::INT64(3); EXPECT_EQ(table.VertexNum(0), 0); neug::vid_t lid1; @@ -533,7 +531,7 @@ TEST_F(VertexTableTest, DeleteAlreadyDeletedVertex) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid = neug::execution::Value::INT64(1); + auto oid = neug::Value::INT64(1); neug::vid_t lid; EXPECT_TRUE(table.AddVertex(oid, property_values_, lid, 1, false)); @@ -556,7 +554,7 @@ TEST_F(VertexTableTest, RevertNonDeletedVertex) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - auto oid = neug::execution::Value::INT64(1); + auto oid = neug::Value::INT64(1); neug::vid_t lid; EXPECT_TRUE(table.AddVertex(oid, property_values_, lid, 1, false)); @@ -570,7 +568,7 @@ TEST_F(VertexTableTest, RevertNonDeletedVertex) { // Test complex combination with dump and reload TEST_F(VertexTableTest, ComplexAddDeleteRevertDumpReload) { - std::vector oids; + std::vector oids; std::vector lids; lids.resize(20); @@ -584,7 +582,7 @@ TEST_F(VertexTableTest, ComplexAddDeleteRevertDumpReload) { table.EnsureCapacity(100); for (int64_t i = 0; i < 20; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); oids.push_back(oid); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], i, false)); } @@ -636,12 +634,12 @@ TEST_F(VertexTableTest, StressAddDeleteRevert) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(1000); - std::vector oids; + std::vector oids; std::vector lids; lids.resize(100); for (int64_t i = 0; i < 100; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); oids.push_back(oid); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], 1, false)); } @@ -745,12 +743,12 @@ TEST_F(VertexTableTest, VertexSetForeachVertex) { OpenVertexTableLegacy(table, ckp, neug::CheckpointManifest(), memory_level_); table.EnsureCapacity(100); - std::vector oids; + std::vector oids; std::vector lids; lids.resize(10); for (int64_t i = 0; i < 10; ++i) { - auto oid = neug::execution::Value::INT64(i); + auto oid = neug::Value::INT64(i); oids.push_back(oid); EXPECT_TRUE(table.AddVertex(oid, property_values_, lids[i], i, false)); } diff --git a/tests/transaction/test_acid.cc b/tests/transaction/test_acid.cc index 138778d77..74a81b62f 100644 --- a/tests/transaction/test_acid.cc +++ b/tests/transaction/test_acid.cc @@ -24,7 +24,7 @@ #include #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/neug_db.h" #include "neug/server/neug_db_service.h" #include "neug/server/neug_db_session.h" @@ -45,8 +45,8 @@ using oid_t = int64_t; // Utility: Generate unique id (thread-safe) static std::atomic neug_current_id(0); -neug::execution::Value neug_generate_id() { - return neug::execution::Value::INT64(neug_current_id.fetch_add(1)); +neug::Value neug_generate_id() { + return neug::Value::INT64(neug_current_id.fetch_add(1)); } std::string neug_generate_random_string(int length) { @@ -190,8 +190,7 @@ void neug_append_string_to_field(StorageTPUpdateInterface& gui, label_t label, cur_str += ";"; cur_str += str; } - gui.UpdateVertexProperty(label, vit, col_id, - neug::execution::Value::STRING(cur_str)); + gui.UpdateVertexProperty(label, vit, col_id, neug::Value::STRING(cur_str)); } // Atomicity helpers and tests @@ -220,18 +219,16 @@ std::shared_ptr neug_AtomicityInit( std::string name2 = "Bob"; std::string email2 = "bob@hotmail.com;bobby@yahoo.com"; vid_t vid; - EXPECT_TRUE( - gii.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(id1), - neug::execution::Value::STRING(std::string(name1)), - neug::execution::Value::STRING(std::string(email1))}, - vid)); - EXPECT_TRUE( - gii.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(id2), - neug::execution::Value::STRING(std::string(name2)), - neug::execution::Value::STRING(std::string(email2))}, - vid)); + EXPECT_TRUE(gii.AddVertex( + person_label_id, neug_generate_id(), + {neug::Value::INT64(id1), neug::Value::STRING(std::string(name1)), + neug::Value::STRING(std::string(email1))}, + vid)); + EXPECT_TRUE(gii.AddVertex( + person_label_id, neug_generate_id(), + {neug::Value::INT64(id2), neug::Value::STRING(std::string(name2)), + neug::Value::STRING(std::string(email2))}, + vid)); txn.Commit(); return service; @@ -250,16 +247,16 @@ bool neug_AtomicityC(neug::NeugDBSession& db, int64_t person2_id, vid_t vid; if (!gui.AddVertex(person_label_id, p2_id, - {neug::execution::Value::INT64(person2_id), - neug::execution::Value::STRING(std::string(name)), - neug::execution::Value::STRING(std::string(email))}, + {neug::Value::INT64(person2_id), + neug::Value::STRING(std::string(name)), + neug::Value::STRING(std::string(email))}, vid)) { txn.Abort(); return false; } const void* edge_prop = nullptr; if (!gui.AddEdge(person_label_id, vit, person_label_id, vid, knows_label_id, - {neug::execution::Value::INT64(since)}, edge_prop)) { + {neug::Value::INT64(since)}, edge_prop)) { txn.Abort(); return false; } @@ -275,20 +272,19 @@ bool neug_AtomicityRB(neug::NeugDBSession& db, int64_t person2_id, auto vit1 = neug_get_random_vertex(gui, person_label_id); neug_append_string_to_field(gui, person_label_id, vit1, 2, new_email); neug::vid_t vit2; - if (gui.GetVertexIndex(person_label_id, - neug::execution::Value::INT64(person2_id), vit2)) { + if (gui.GetVertexIndex(person_label_id, neug::Value::INT64(person2_id), + vit2)) { txn.Abort(); return false; } auto p2_id = neug_generate_id(); std::string name = "", email = ""; vid_t vid; - EXPECT_TRUE( - gui.AddVertex(person_label_id, p2_id, - {neug::execution::Value::INT64(person2_id), - neug::execution::Value::STRING(std::string(name)), - neug::execution::Value::STRING(std::string(email))}, - vid)); + EXPECT_TRUE(gui.AddVertex( + person_label_id, p2_id, + {neug::Value::INT64(person2_id), neug::Value::STRING(std::string(name)), + neug::Value::STRING(std::string(email))}, + vid)); EXPECT_TRUE(txn.Commit()); return true; } @@ -359,19 +355,19 @@ std::shared_ptr G0Init(NeugDB& db, int64_t p1_id_property = 2 * i + 1; vid_t vid0, vid1; CHECK(gii.AddVertex(person_label_id, p1_id, - {neug::execution::Value::INT64(p1_id_property), - neug::execution::Value::STRING(std::string(value))}, + {neug::Value::INT64(p1_id_property), + neug::Value::STRING(std::string(value))}, vid0)); auto p2_id = neug_generate_id(); int64_t p2_id_property = 2 * i + 2; CHECK(gii.AddVertex(person_label_id, p2_id, - {neug::execution::Value::INT64(p2_id_property), - neug::execution::Value::STRING(std::string(value))}, + {neug::Value::INT64(p2_id_property), + neug::Value::STRING(std::string(value))}, vid1)); const void* edge_prop = nullptr; - CHECK(gii.AddEdge( - person_label_id, vid0, person_label_id, vid1, knows_label_id, - {neug::execution::Value::STRING(std::string(value))}, edge_prop)); + CHECK(gii.AddEdge(person_label_id, vid0, person_label_id, vid1, + knows_label_id, {neug::Value::STRING(std::string(value))}, + edge_prop)); } txn.Commit(); return svc; @@ -437,7 +433,7 @@ void G0(neug::NeugDBSession& db, int64_t person1_id, int64_t person2_id, cur_str += ";"; cur_str += std::to_string(txn_id); } - neug::execution::Value new_value = neug::execution::Value::STRING(cur_str); + neug::Value new_value = neug::Value::STRING(cur_str); ed_accessor.set_data(oeit, new_value, txn.timestamp()); @@ -530,10 +526,9 @@ std::shared_ptr InitPersonWithVersion( StorageTPInsertInterface gii(txn); for (int i = 0; i < 100; ++i) { vid_t vid; - CHECK(gii.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(i + 1), - neug::execution::Value::INT64(initial_version)}, - vid)); + CHECK(gii.AddVertex( + person_label_id, neug_generate_id(), + {neug::Value::INT64(i + 1), neug::Value::INT64(initial_version)}, vid)); } txn.Commit(); return svc; @@ -546,11 +541,9 @@ void G1B1(neug::NeugDBSession& db, int64_t even, int64_t odd) { StorageTPUpdateInterface gui(txn); auto person_label_id = txn.schema().get_vertex_label_id("PERSON"); auto vit = neug_get_random_vertex(gui, person_label_id); - gui.UpdateVertexProperty(person_label_id, vit, 1, - neug::execution::Value::INT64(even)); + gui.UpdateVertexProperty(person_label_id, vit, 1, neug::Value::INT64(even)); std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MILLI_SEC)); - gui.UpdateVertexProperty(person_label_id, vit, 1, - neug::execution::Value::INT64(odd)); + gui.UpdateVertexProperty(person_label_id, vit, 1, neug::Value::INT64(odd)); txn.Commit(); } @@ -588,7 +581,7 @@ int64_t G1C(neug::NeugDBSession& db, int64_t person1_id, int64_t person2_id, } } gui.UpdateVertexProperty(person_label_id, person1_vid, 1, - neug::execution::Value::INT64(txn_id)); + neug::Value::INT64(txn_id)); CHECK(flag); neug::vid_t person2_vid; @@ -621,8 +614,7 @@ void G1A1(neug::NeugDBSession& db) { std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MILLI_SEC)); // attempt to set version = 2 - gui.UpdateVertexProperty(person_label_id, vit, 1, - neug::execution::Value::INT64(2)); + gui.UpdateVertexProperty(person_label_id, vit, 1, neug::Value::INT64(2)); std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MILLI_SEC)); txn.Abort(); @@ -652,7 +644,7 @@ void IMP1(neug::NeugDBSession& db) { int64_t old_version = gui.GetVertexProperty(person_label_id, vit, 1).GetValue(); gui.UpdateVertexProperty(person_label_id, vit, 1, - neug::execution::Value::INT64(old_version + 1)); + neug::Value::INT64(old_version + 1)); txn.Commit(); } @@ -724,9 +716,9 @@ std::shared_ptr PMPInit(NeugDB& db, int64_t value = i + 1; vid_t vid; CHECK(gii.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(value)}, vid)); + {neug::Value::INT64(value)}, vid)); CHECK(gii.AddVertex(post_label_id, neug_generate_id(), - {neug::execution::Value::INT64(value)}, vid)); + {neug::Value::INT64(value)}, vid)); } txn.Commit(); return svc; @@ -854,12 +846,12 @@ std::shared_ptr OTVInit(NeugDB& db, int64_t id_property = j * 4 + i; vid_t vid; string_props.push_back(std::to_string(j)); - CHECK(gii.AddVertex( - person_label_id, id, - {neug::execution::Value::INT64(id_property), - neug::execution::Value::STRING(std::string(string_props.back())), - neug::execution::Value::INT64(value)}, - vid)); + CHECK( + gii.AddVertex(person_label_id, id, + {neug::Value::INT64(id_property), + neug::Value::STRING(std::string(string_props.back())), + neug::Value::INT64(value)}, + vid)); vids.push_back(vid); } for (int i = 0; i < 4; i++) { @@ -908,28 +900,28 @@ void OTV1(neug::NeugDBSession& db, int64_t person_id) { if (eit4.get_vertex() == vid1) { gui.UpdateVertexProperty( person_label_id, vid1, 2, - neug::execution::Value::INT64( + neug::Value::INT64( txn.GetVertexProperty(person_label_id, vid1, 2) .GetValue() + 1)); gui.UpdateVertexProperty( person_label_id, vid2, 2, - neug::execution::Value::INT64( + neug::Value::INT64( gui.GetVertexProperty(person_label_id, vid2, 2) .GetValue() + 1)); gui.UpdateVertexProperty( person_label_id, vid3, 2, - neug::execution::Value::INT64( + neug::Value::INT64( gui.GetVertexProperty(person_label_id, vid3, 2) .GetValue() + 1)); gui.UpdateVertexProperty( person_label_id, vid4, 2, - neug::execution::Value::INT64( + neug::Value::INT64( gui.GetVertexProperty(person_label_id, vid4, 2) .GetValue() + 1)); @@ -1050,10 +1042,10 @@ std::shared_ptr LUInit(NeugDB& db, for (int i = 0; i < 100; ++i) { int64_t id_property = i + 1; vid_t vid; - CHECK(gii.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(id_property), - neug::execution::Value::INT64(num_property)}, - vid)); + CHECK(gii.AddVertex( + person_label_id, neug_generate_id(), + {neug::Value::INT64(id_property), neug::Value::INT64(num_property)}, + vid)); } txn.Commit(); @@ -1082,7 +1074,7 @@ bool LU1(neug::NeugDBSession& db, int64_t person_id) { int64_t num_friends = gui.GetVertexProperty(person_label_id, person_vid, 1).GetValue(); gui.UpdateVertexProperty(person_label_id, person_vid, 1, - neug::execution::Value::INT64(num_friends + 1)); + neug::Value::INT64(num_friends + 1)); txn.Commit(); return true; @@ -1135,14 +1127,12 @@ std::shared_ptr WSInit(NeugDB& db, int64_t version1 = 70; vid_t vid; CHECK(gi.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(id1), - neug::execution::Value::INT64(version1)}, + {neug::Value::INT64(id1), neug::Value::INT64(version1)}, vid)); int64_t id2 = 2 * i; int64_t version2 = 80; CHECK(gi.AddVertex(person_label_id, neug_generate_id(), - {neug::execution::Value::INT64(id2), - neug::execution::Value::INT64(version2)}, + {neug::Value::INT64(id2), neug::Value::INT64(version2)}, vid)); } txn.Commit(); @@ -1196,10 +1186,10 @@ void WS1(neug::NeugDBSession& db, int64_t person1_id, int64_t person2_id, // property if (dist(gen)) { gui.UpdateVertexProperty(person_label_id, person1_vid, 1, - neug::execution::Value::INT64(p1_value - 100)); + neug::Value::INT64(p1_value - 100)); } else { gui.UpdateVertexProperty(person_label_id, person2_vid, 1, - neug::execution::Value::INT64(p2_value - 100)); + neug::Value::INT64(p2_value - 100)); } txn.Commit(); } @@ -1592,10 +1582,10 @@ std::shared_ptr cc_init(NeugDB& db, const std::string& work_dir, std::string name = "person_" + std::to_string(i); int64_t age = 20 + i; vid_t vid; - CHECK(txn.AddVertex(person_label, execution::Value::INT64(i), - {execution::Value::STRING(std::string(name)), - execution::Value::INT64(age)}, - vid)); + CHECK(txn.AddVertex( + person_label, neug::Value::INT64(i), + {neug::Value::STRING(std::string(name)), neug::Value::INT64(age)}, + vid)); vids.push_back(vid); } std::mt19937 gen(42); @@ -1607,7 +1597,7 @@ std::shared_ptr cc_init(NeugDB& db, const std::string& work_dir, d = (d + 1) % kSeedVertices; const void* edge_prop = nullptr; CHECK(txn.AddEdge(person_label, vids[s], person_label, vids[d], knows_label, - {execution::Value::DOUBLE(0.1 * e)}, edge_prop)); + {neug::Value::DOUBLE(0.1 * e)}, edge_prop)); } txn.Commit(); return svc; @@ -1620,8 +1610,7 @@ int64_t cc_read_age(NeugDBService& svc, int64_t person_id) { StorageReadInterface gi(txn.view(), txn.timestamp()); auto person_label = svc.db().schema().get_vertex_label_id("person"); vid_t vid; - if (!gi.GetVertexIndex(person_label, execution::Value::INT64(person_id), - vid)) { + if (!gi.GetVertexIndex(person_label, neug::Value::INT64(person_id), vid)) { return -1; } return gi.GetVertexProperty(person_label, vid, 1).GetValue(); @@ -1634,8 +1623,7 @@ int64_t cc_read_age(NeugDBSession& sess, NeugDB& db, int64_t person_id) { StorageReadInterface gi(txn.view(), txn.timestamp()); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - if (!gi.GetVertexIndex(person_label, execution::Value::INT64(person_id), - vid)) { + if (!gi.GetVertexIndex(person_label, neug::Value::INT64(person_id), vid)) { return -1; } return gi.GetVertexProperty(person_label, vid, 1).GetValue(); @@ -1651,8 +1639,7 @@ std::pair cc_read_age_timed(NeugDBSession& sess, NeugDB& db, auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; int64_t age = -1; - if (gi.GetVertexIndex(person_label, execution::Value::INT64(person_id), - vid)) { + if (gi.GetVertexIndex(person_label, neug::Value::INT64(person_id), vid)) { age = gi.GetVertexProperty(person_label, vid, 1).GetValue(); } auto t1 = std::chrono::high_resolution_clock::now(); @@ -1668,8 +1655,7 @@ int64_t cc_read_age_via(const ReadTransaction& txn, NeugDB& db, StorageReadInterface gi(txn.view(), txn.timestamp()); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - if (!gi.GetVertexIndex(person_label, execution::Value::INT64(person_id), - vid)) { + if (!gi.GetVertexIndex(person_label, neug::Value::INT64(person_id), vid)) { return -1; } return gi.GetVertexProperty(person_label, vid, 1).GetValue(); @@ -1700,7 +1686,7 @@ template vid_t cc_person_vid(Txn& txn, NeugDB& db, int64_t oid) { auto p_label = db.schema().get_vertex_label_id("person"); vid_t vid; - CHECK(txn.GetVertexIndex(p_label, execution::Value::INT64(oid), vid)); + CHECK(txn.GetVertexIndex(p_label, neug::Value::INT64(oid), vid)); return vid; } @@ -1711,13 +1697,11 @@ bool cc_update_age(NeugDBService& svc, int64_t person_id, int64_t new_age) { StorageTPUpdateInterface gui(txn); auto person_label = svc.db().schema().get_vertex_label_id("person"); vid_t vid; - if (!gui.GetVertexIndex(person_label, execution::Value::INT64(person_id), - vid)) { + if (!gui.GetVertexIndex(person_label, neug::Value::INT64(person_id), vid)) { txn.Abort(); return false; } - gui.UpdateVertexProperty(person_label, vid, 1, - execution::Value::INT64(new_age)); + gui.UpdateVertexProperty(person_label, vid, 1, neug::Value::INT64(new_age)); return txn.Commit(); } @@ -1803,9 +1787,9 @@ double cc_read_knows_weight_via(const ReadTransaction& txn, NeugDB& db, auto p_label = gi.schema().get_vertex_label_id("person"); auto e_label = gi.schema().get_edge_label_id("knows"); vid_t src_vid, dst_vid; - if (!gi.GetVertexIndex(p_label, execution::Value::INT64(src_oid), src_vid)) + if (!gi.GetVertexIndex(p_label, neug::Value::INT64(src_oid), src_vid)) return std::nan(""); - if (!gi.GetVertexIndex(p_label, execution::Value::INT64(dst_oid), dst_vid)) + if (!gi.GetVertexIndex(p_label, neug::Value::INT64(dst_oid), dst_vid)) return std::nan(""); auto view = gi.GetGenericOutgoingGraphView(p_label, p_label, e_label); auto accessor = gi.GetEdgeDataAccessor(p_label, p_label, e_label, 0); @@ -1832,38 +1816,37 @@ void cc_setup_unbundled_created(NeugDBService& svc) { ASSERT_TRUE( gui.CreateVertexType( sb.VertexLabel("software") - .AddProperty("id", execution::Value::INT64(0)) - .AddProperty("name", execution::Value::STRING(std::string(""))) + .AddProperty("id", neug::Value::INT64(0)) + .AddProperty("name", neug::Value::STRING(std::string(""))) .AddPrimaryKeyName("id") .Build()) .ok()); CreateEdgeTypeParamBuilder eb; - ASSERT_TRUE(gui.CreateEdgeType( - eb.SrcLabel("person") - .DstLabel("software") - .EdgeLabel("created") - .AddProperty("weight", execution::Value::DOUBLE(0.0)) - .AddProperty("since", execution::Value::INT64(0)) - .Build()) - .ok()); + ASSERT_TRUE( + gui.CreateEdgeType(eb.SrcLabel("person") + .DstLabel("software") + .EdgeLabel("created") + .AddProperty("weight", neug::Value::DOUBLE(0.0)) + .AddProperty("since", neug::Value::INT64(0)) + .Build()) + .ok()); auto sw_label = gui.schema().get_vertex_label_id("software"); auto p_label = gui.schema().get_vertex_label_id("person"); auto e_label = gui.schema().get_edge_label_id("created"); vid_t sw_vid; - ASSERT_TRUE(gui.AddVertex(sw_label, execution::Value::INT64(1), - {execution::Value::STRING(std::string("NeugDB"))}, + ASSERT_TRUE(gui.AddVertex(sw_label, neug::Value::INT64(1), + {neug::Value::STRING(std::string("NeugDB"))}, sw_vid)); vid_t p1_vid; - ASSERT_TRUE(gui.GetVertexIndex(p_label, execution::Value::INT64(1), p1_vid)); + ASSERT_TRUE(gui.GetVertexIndex(p_label, neug::Value::INT64(1), p1_vid)); const void* add_edge_prop = nullptr; - ASSERT_TRUE(gui.AddEdge( - p_label, p1_vid, sw_label, sw_vid, e_label, - {execution::Value::DOUBLE(0.5), execution::Value::INT64(2020)}, - add_edge_prop)); + ASSERT_TRUE(gui.AddEdge(p_label, p1_vid, sw_label, sw_vid, e_label, + {neug::Value::DOUBLE(0.5), neug::Value::INT64(2020)}, + add_edge_prop)); ASSERT_TRUE(txn.Commit()); } @@ -1876,9 +1859,9 @@ int64_t cc_read_created_since_via(const ReadTransaction& txn) { auto sw_label = gi.schema().get_vertex_label_id("software"); auto e_label = gi.schema().get_edge_label_id("created"); vid_t p1_vid, sw_vid; - if (!gi.GetVertexIndex(p_label, execution::Value::INT64(1), p1_vid)) + if (!gi.GetVertexIndex(p_label, neug::Value::INT64(1), p1_vid)) return -1; - if (!gi.GetVertexIndex(sw_label, execution::Value::INT64(1), sw_vid)) + if (!gi.GetVertexIndex(sw_label, neug::Value::INT64(1), sw_vid)) return -1; auto view = gi.GetGenericOutgoingGraphView(p_label, sw_label, e_label); auto accessor = gi.GetEdgeDataAccessor(p_label, sw_label, e_label, 1); @@ -1956,11 +1939,10 @@ TEST_F(NeugDBACIDTest, ConcurrentInsertsCommitInOrder) { for (int i = 0; i < kPerThread; ++i) { auto txn = sess.GetInsertTransaction(); vid_t vid; - ASSERT_TRUE( - txn.AddVertex(person_label, execution::Value::INT64(base + i), - {execution::Value::STRING(std::string("inserted")), - execution::Value::INT64(99)}, - vid)); + ASSERT_TRUE(txn.AddVertex(person_label, neug::Value::INT64(base + i), + {neug::Value::STRING(std::string("inserted")), + neug::Value::INT64(99)}, + vid)); ASSERT_TRUE(txn.Commit()); } }); @@ -2017,10 +1999,10 @@ TEST_F(NeugDBACIDTest, ConcurrentReadsAndInsertsDoNotInterfere) { int64_t id = next_id.fetch_add(1); auto txn = guard->GetInsertTransaction(); vid_t vid; - if (txn.AddVertex(person_label, execution::Value::INT64(id), - {execution::Value::STRING(std::string("x")), - execution::Value::INT64(99)}, - vid) && + if (txn.AddVertex( + person_label, neug::Value::INT64(id), + {neug::Value::STRING(std::string("x")), neug::Value::INT64(99)}, + vid) && txn.Commit()) { insert_count.fetch_add(1); } @@ -2066,10 +2048,10 @@ TEST_F(NeugDBACIDTest, SnapshotIsolationForUpdateAndInsert) { auto txn_w = sess_w->GetInsertTransaction(); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE(txn_w.AddVertex(person_label, execution::Value::INT64(9999), - {execution::Value::STRING(std::string("late")), - execution::Value::INT64(50)}, - vid)); + ASSERT_TRUE(txn_w.AddVertex( + person_label, neug::Value::INT64(9999), + {neug::Value::STRING(std::string("late")), neug::Value::INT64(50)}, + vid)); ASSERT_TRUE(txn_w.Commit()); } @@ -2097,10 +2079,8 @@ TEST_F(NeugDBACIDTest, UpdateCowCloneDoesNotAffectActiveReaders) { StorageTPUpdateInterface gui(txn_u); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid_u; - ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(5), vid_u)); - gui.UpdateVertexProperty(person_label, vid_u, 1, - execution::Value::INT64(7777)); + ASSERT_TRUE(gui.GetVertexIndex(person_label, neug::Value::INT64(5), vid_u)); + gui.UpdateVertexProperty(person_label, vid_u, 1, neug::Value::INT64(7777)); // R still sees pre-commit state (no concurrent commit). EXPECT_EQ(cc_read_age_via(txn_r, db, 5), 25); @@ -2124,7 +2104,7 @@ TEST_F(NeugDBACIDTest, UpdateRollbackLeavesOriginalIntact) { auto txn = sess->GetUpdateTransaction(); StorageTPUpdateInterface gui(txn); gui.UpdateVertexProperty(person_label, cc_person_vid(gui, db, 5), 1, - execution::Value::INT64(125)); + neug::Value::INT64(125)); txn.Abort(); } EXPECT_EQ(cc_read_age(*svc, 5), 25); @@ -2138,7 +2118,7 @@ TEST_F(NeugDBACIDTest, UpdateRollbackLeavesOriginalIntact) { CreateVertexTypeParamBuilder b; auto status = gui.CreateVertexType(b.VertexLabel("foo") - .AddProperty("x", execution::Value::INT64(0)) + .AddProperty("x", neug::Value::INT64(0)) .AddPrimaryKeyName("x") .Build()); ASSERT_TRUE(status.ok()) << "CreateVertexType setup failed"; @@ -2194,7 +2174,7 @@ TEST_F(NeugDBACIDTest, DMLCommitDoesNotAffectHeldReader) { vid_t r_v1; { StorageReadInterface gi(txn_r.view(), txn_r.timestamp()); - ASSERT_TRUE(gi.GetVertexIndex(p_label, execution::Value::INT64(1), r_v1)); + ASSERT_TRUE(gi.GetVertexIndex(p_label, neug::Value::INT64(1), r_v1)); } size_t oe_v1_pre = cc_count_oe_from_via(txn_r, p_label, p_label, e_label, r_v1); @@ -2203,18 +2183,17 @@ TEST_F(NeugDBACIDTest, DMLCommitDoesNotAffectHeldReader) { cc_run_update(*svc, [&](auto& txn) { StorageTPUpdateInterface gui(txn); vid_t vid; - ASSERT_TRUE(gui.AddVertex(p_label, execution::Value::INT64(900001), - {execution::Value::STRING(std::string("late")), - execution::Value::INT64(77)}, - vid)); + ASSERT_TRUE(gui.AddVertex( + p_label, neug::Value::INT64(900001), + {neug::Value::STRING(std::string("late")), neug::Value::INT64(77)}, + vid)); }); // Held reader: unaffected. EXPECT_EQ(cc_count_vertices_via(txn_r, p_label), n_pre); { StorageReadInterface gi(txn_r.view(), txn_r.timestamp()); vid_t v; - EXPECT_FALSE( - gi.GetVertexIndex(p_label, execution::Value::INT64(900001), v)); + EXPECT_FALSE(gi.GetVertexIndex(p_label, neug::Value::INT64(900001), v)); } // Fresh reader: sees new vertex. EXPECT_EQ(cc_count_persons(*svc), n_pre + 1); @@ -2237,7 +2216,7 @@ TEST_F(NeugDBACIDTest, DMLCommitDoesNotAffectHeldReader) { const void* edge_prop = nullptr; EXPECT_TRUE(gui.AddEdge(p_label, cc_person_vid(gui, db, 1), p_label, cc_person_vid(gui, db, 2), e_label, - {execution::Value::DOUBLE(0.55)}, edge_prop)); + {neug::Value::DOUBLE(0.55)}, edge_prop)); }); // Held reader: edge counts unchanged. EXPECT_EQ(cc_count_oe_from_via(txn_r, p_label, p_label, e_label, r_v1), @@ -2251,7 +2230,7 @@ TEST_F(NeugDBACIDTest, DMLCommitDoesNotAffectHeldReader) { const void* edge_prop = nullptr; EXPECT_TRUE(gui.AddEdge(p_label, cc_person_vid(gui, db, 1), p_label, cc_person_vid(gui, db, 2), e_label, - {execution::Value::DOUBLE(0.42)}, edge_prop)); + {neug::Value::DOUBLE(0.42)}, edge_prop)); }); size_t total_after_adds = cc_count_all_oe(*svc, "person", "person", "knows"); cc_run_update(*svc, [&](auto& txn) { @@ -2294,14 +2273,14 @@ TEST_F(NeugDBACIDTest, for (auto it = edges.begin(); it != edges.end(); ++it, ++oe_off) { if (it.get_vertex() == d) { gui.UpdateEdgeProperty(p_label, s, p_label, d, e_label, oe_off, 0, 0, - execution::Value::DOUBLE(w)); + neug::Value::DOUBLE(w)); return; } } // No existing edge — add one. const void* edge_prop = nullptr; EXPECT_TRUE(gui.AddEdge(p_label, s, p_label, d, e_label, - {execution::Value::DOUBLE(w)}, edge_prop)); + {neug::Value::DOUBLE(w)}, edge_prop)); }); }; set_or_add_weight(0.42); @@ -2324,8 +2303,8 @@ TEST_F(NeugDBACIDTest, auto view = gi.GetGenericOutgoingGraphView(p_label, p_label, e_label); auto accessor = gi.GetEdgeDataAccessor(p_label, p_label, e_label, 0); vid_t s, d; - ASSERT_TRUE(gi.GetVertexIndex(p_label, execution::Value::INT64(1), s)); - ASSERT_TRUE(gi.GetVertexIndex(p_label, execution::Value::INT64(2), d)); + ASSERT_TRUE(gi.GetVertexIndex(p_label, neug::Value::INT64(1), s)); + ASSERT_TRUE(gi.GetVertexIndex(p_label, neug::Value::INT64(2), d)); auto edges = view.get_edges(s); for (auto it = edges.begin(); it != edges.end(); ++it) { if (it.get_vertex() == d && @@ -2365,10 +2344,10 @@ TEST_F(NeugDBACIDTest, auto sw_label = txn.schema().get_vertex_label_id("software"); auto e_label = txn.schema().get_edge_label_id("created"); vid_t p1, sw1; - ASSERT_TRUE(txn.GetVertexIndex(p_label, execution::Value::INT64(1), p1)); - ASSERT_TRUE(txn.GetVertexIndex(sw_label, execution::Value::INT64(1), sw1)); + ASSERT_TRUE(txn.GetVertexIndex(p_label, neug::Value::INT64(1), p1)); + ASSERT_TRUE(txn.GetVertexIndex(sw_label, neug::Value::INT64(1), sw1)); gui.UpdateEdgeProperty(p_label, p1, sw_label, sw1, e_label, 0, 0, 1, - execution::Value::INT64(2099)); + neug::Value::INT64(2099)); }); // Held reader: still sees 2020 via its snapshot. @@ -2406,13 +2385,13 @@ TEST_F(NeugDBACIDTest, VertexPropertyDDLCommitDoesNotAffectHeldReader) { cc_run_update(*svc, [&](auto& txn) { StorageTPUpdateInterface gui(txn); AddVertexPropertiesParamBuilder b; - EXPECT_TRUE(gui.AddVertexProperties( - b.VertexLabel("person") - .AddProperty("email", execution::Value::STRING( - std::string(""))) - .AddProperty("height", execution::Value::DOUBLE(0.0)) - .Build()) - .ok()); + EXPECT_TRUE( + gui.AddVertexProperties( + b.VertexLabel("person") + .AddProperty("email", neug::Value::STRING(std::string(""))) + .AddProperty("height", neug::Value::DOUBLE(0.0)) + .Build()) + .ok()); }); // Held reader: no new columns visible. { @@ -2496,14 +2475,14 @@ TEST_F(NeugDBACIDTest, EdgePropertyDDLCommitDoesNotAffectHeldReader) { cc_run_update(*svc, [&](auto& txn) { StorageTPUpdateInterface gui(txn); AddEdgePropertiesParamBuilder b; - EXPECT_TRUE(gui.AddEdgeProperties( - b.SrcLabel("person") - .DstLabel("person") - .EdgeLabel("knows") - .AddProperty("license", execution::Value::STRING( - std::string(""))) - .Build()) - .ok()); + EXPECT_TRUE( + gui.AddEdgeProperties( + b.SrcLabel("person") + .DstLabel("person") + .EdgeLabel("knows") + .AddProperty("license", neug::Value::STRING(std::string(""))) + .Build()) + .ok()); }); // Held reader: no `license`. { @@ -2609,12 +2588,12 @@ TEST_F(NeugDBACIDTest, SchemaTypeDDLCommitDoesNotAffectHeldReader) { StorageTPUpdateInterface gui(txn); CreateVertexTypeParamBuilder b; EXPECT_TRUE( - gui.CreateVertexType(b.VertexLabel("company") - .AddProperty("id", execution::Value::INT64(0)) - .AddProperty("name", execution::Value::STRING( - std::string(""))) - .AddPrimaryKeyName("id") - .Build()) + gui.CreateVertexType( + b.VertexLabel("company") + .AddProperty("id", neug::Value::INT64(0)) + .AddProperty("name", neug::Value::STRING(std::string(""))) + .AddPrimaryKeyName("id") + .Build()) .ok()); }); // Held reader: no `company`. @@ -2661,7 +2640,7 @@ TEST_F(NeugDBACIDTest, SchemaTypeDDLCommitDoesNotAffectHeldReader) { EXPECT_TRUE(gi.schema().is_vertex_label_valid("person")); EXPECT_TRUE(gi.schema().is_edge_label_valid("knows")); vid_t v; - ASSERT_TRUE(gi.GetVertexIndex(p_label, execution::Value::INT64(5), v)); + ASSERT_TRUE(gi.GetVertexIndex(p_label, neug::Value::INT64(5), v)); EXPECT_EQ(gi.GetVertexProperty(p_label, v, age_col_id).GetValue(), 25); } @@ -2735,7 +2714,7 @@ TEST_F(NeugDBACIDTest, UpdateStringPropertyCommitDoesNotAffectHeldReader) { auto read_name_via = [&](const ReadTransaction& txn, int64_t oid) { StorageReadInterface gi(txn.view(), txn.timestamp()); vid_t v; - if (!gi.GetVertexIndex(p_label, execution::Value::INT64(oid), v)) + if (!gi.GetVertexIndex(p_label, neug::Value::INT64(oid), v)) return std::string(); return std::string( gi.GetVertexProperty(p_label, v, 0).GetValue()); @@ -2749,9 +2728,8 @@ TEST_F(NeugDBACIDTest, UpdateStringPropertyCommitDoesNotAffectHeldReader) { // Writer updates person 5's name to a new string. cc_run_update(*svc, [&](auto& txn) { StorageTPUpdateInterface gui(txn); - gui.UpdateVertexProperty( - p_label, cc_person_vid(txn, db, 5), 0, - execution::Value::STRING(std::string("renamed_5"))); + gui.UpdateVertexProperty(p_label, cc_person_vid(txn, db, 5), 0, + neug::Value::STRING(std::string("renamed_5"))); }); // Held reader: still sees old name. @@ -2792,10 +2770,8 @@ TEST_F(NeugDBACIDTest, WriteMutexExclusionSemantics) { StorageTPUpdateInterface gui(txn); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(1), vid)); - gui.UpdateVertexProperty(person_label, vid, 1, - execution::Value::INT64(100)); + ASSERT_TRUE(gui.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); + gui.UpdateVertexProperty(person_label, vid, 1, neug::Value::INT64(100)); EXPECT_TRUE(txn.Commit()); u1_committed.store(true); }); @@ -2810,10 +2786,8 @@ TEST_F(NeugDBACIDTest, WriteMutexExclusionSemantics) { StorageTPUpdateInterface gui(txn); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(2), vid)); - gui.UpdateVertexProperty(person_label, vid, 1, - execution::Value::INT64(200)); + ASSERT_TRUE(gui.GetVertexIndex(person_label, neug::Value::INT64(2), vid)); + gui.UpdateVertexProperty(person_label, vid, 1, neug::Value::INT64(200)); EXPECT_TRUE(txn.Commit()); }); @@ -2838,10 +2812,8 @@ TEST_F(NeugDBACIDTest, WriteMutexExclusionSemantics) { StorageTPUpdateInterface gui(txn); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(1), vid)); - gui.UpdateVertexProperty(person_label, vid, 1, - execution::Value::INT64(777)); + ASSERT_TRUE(gui.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); + gui.UpdateVertexProperty(person_label, vid, 1, neug::Value::INT64(777)); EXPECT_TRUE(txn.Commit()); update_committed.store(true); }); @@ -2855,11 +2827,10 @@ TEST_F(NeugDBACIDTest, WriteMutexExclusionSemantics) { << "InsertTxn must only acquire after UpdateTxn commits"; auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - txn.AddVertex(person_label, execution::Value::INT64(999999), - {execution::Value::STRING(std::string("blocked")), - execution::Value::INT64(42)}, - vid)); + ASSERT_TRUE(txn.AddVertex( + person_label, neug::Value::INT64(999999), + {neug::Value::STRING(std::string("blocked")), neug::Value::INT64(42)}, + vid)); EXPECT_TRUE(txn.Commit()); }); @@ -2892,8 +2863,7 @@ TEST_F(NeugDBACIDTest, LongRunningReadDoesNotBlockUpdateCommit) { StorageReadInterface gi(txn.view(), txn.timestamp()); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - gi.GetVertexIndex(person_label, execution::Value::INT64(1), vid)); + ASSERT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); // Hold the read for 300ms — well beyond Update::Commit's typical // microsecond-scale publish window. std::this_thread::sleep_for(std::chrono::milliseconds(300)); @@ -2911,10 +2881,8 @@ TEST_F(NeugDBACIDTest, LongRunningReadDoesNotBlockUpdateCommit) { StorageTPUpdateInterface gui(txn); auto person_label = db.schema().get_vertex_label_id("person"); vid_t vid; - ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(1), vid)); - gui.UpdateVertexProperty(person_label, vid, 1, - execution::Value::INT64(999)); + ASSERT_TRUE(gui.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); + gui.UpdateVertexProperty(person_label, vid, 1, neug::Value::INT64(999)); auto t0 = std::chrono::steady_clock::now(); EXPECT_TRUE(txn.Commit()); auto elapsed = std::chrono::steady_clock::now() - t0; @@ -2976,7 +2944,7 @@ TEST_F(NeugDBACIDTest, CommitVisibilitySemantics) { StorageTPUpdateInterface gui(txn_u); gui.UpdateVertexProperty(db.schema().get_vertex_label_id("person"), cc_person_vid(gui, db, 5), 1, - execution::Value::INT64(9999)); + neug::Value::INT64(9999)); expect_all_readers_see(*svc, 25); txn_u.Abort(); } @@ -3043,9 +3011,9 @@ TEST_F(NeugDBACIDTest, ConcurrentReadsAndCommitsObserveConsistentValues) { StorageTPUpdateInterface gui(txn_u); vid_t vid_u; ASSERT_TRUE( - gui.GetVertexIndex(person_label, execution::Value::INT64(5), vid_u)); + gui.GetVertexIndex(person_label, neug::Value::INT64(5), vid_u)); gui.UpdateVertexProperty(person_label, vid_u, 1, - execution::Value::INT64(post_value)); + neug::Value::INT64(post_value)); ready.fetch_add(1); while (ready.load() < 2) {} txn_u.Commit(); diff --git a/tests/transaction/test_insert_transaction.cc b/tests/transaction/test_insert_transaction.cc index 2dbc5d623..0ba3a28d0 100644 --- a/tests/transaction/test_insert_transaction.cc +++ b/tests/transaction/test_insert_transaction.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/neug.h" #include "neug/server/neug_db_service.h" #include "neug/storages/csr/csr_view_utils.h" @@ -127,11 +127,10 @@ TEST_F(InsertTransactionTest, AddVertex) { neug::StorageTPInsertInterface interface(txn); auto person_label = interface.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE( - interface.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid)); + EXPECT_TRUE(interface.AddVertex( + person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), neug::Value::INT64(28)}, + vid)); EXPECT_TRUE(txn.Commit()); } { @@ -158,17 +157,14 @@ TEST_F(InsertTransactionTest, AddEdge) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); neug::vid_t vid2; - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(2), vid2)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(2), vid2)); const void* edge_prop = nullptr; - EXPECT_TRUE(interface.AddEdge(person_label, vid, software_label, vid2, - created_label, - {neug::execution::Value::DOUBLE(0.9), - neug::execution::Value::INT64(2022)}, - edge_prop)); + EXPECT_TRUE(interface.AddEdge( + person_label, vid, software_label, vid2, created_label, + {neug::Value::DOUBLE(0.9), neug::Value::INT64(2022)}, edge_prop)); EXPECT_TRUE(txn.Commit()); } { diff --git a/tests/transaction/test_update_transaction.cc b/tests/transaction/test_update_transaction.cc index 09dd4318d..8bdc1ad95 100644 --- a/tests/transaction/test_update_transaction.cc +++ b/tests/transaction/test_update_transaction.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/neug.h" #include "neug/server/neug_db_service.h" #include "neug/storages/csr/csr_view_utils.h" @@ -132,15 +132,14 @@ class UpdateTransactionTest : public ::testing::Test { neug::label_t& employ_label) { auto person_label = interface.schema().get_vertex_label_id("person"); auto software_label = interface.schema().get_vertex_label_id("software"); - std::vector> edge_props = { - std::make_pair("rating", neug::execution::Value::DOUBLE(0.0)), - std::make_pair("year", neug::execution::Value::INT64(2000))}; + std::vector> edge_props = { + std::make_pair("rating", neug::Value::DOUBLE(0.0)), + std::make_pair("year", neug::Value::INT64(2000))}; EXPECT_TRUE(interface.CreateEdgeType(BuildCreateEdgeTypeParam( "person", "software", "developed", edge_props))); - std::vector> v_props = { - std::make_pair("id", neug::execution::Value::INT64(0)), - std::make_pair("name", - neug::execution::Value::STRING(std::string("")))}; + std::vector> v_props = { + std::make_pair("id", neug::Value::INT64(0)), + std::make_pair("name", neug::Value::STRING(std::string("")))}; EXPECT_TRUE(interface.CreateVertexType( BuildCreateVertexTypeParam("company", v_props, {"id"}))); EXPECT_TRUE(interface.CreateEdgeType( @@ -150,23 +149,20 @@ class UpdateTransactionTest : public ::testing::Test { dev_label = interface.schema().get_edge_label_id("developed"); neug::vid_t vid; EXPECT_TRUE(interface.AddVertex( - cmp_label, neug::execution::Value::INT64(1), - {neug::execution::Value::STRING(std::string("TechCorp"))}, vid)); + cmp_label, neug::Value::INT64(1), + {neug::Value::STRING(std::string("TechCorp"))}, vid)); neug::vid_t p1_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); neug::vid_t software_vid; - EXPECT_TRUE(txn.GetVertexIndex( - software_label, neug::execution::Value::INT64(1), software_vid)); + EXPECT_TRUE(txn.GetVertexIndex(software_label, neug::Value::INT64(1), + software_vid)); neug::vid_t cmp_vid; - EXPECT_TRUE(txn.GetVertexIndex(cmp_label, neug::execution::Value::INT64(1), - cmp_vid)); + EXPECT_TRUE(txn.GetVertexIndex(cmp_label, neug::Value::INT64(1), cmp_vid)); const void* edge_prop = nullptr; - EXPECT_TRUE(interface.AddEdge(person_label, p1_vid, software_label, - software_vid, dev_label, - {neug::execution::Value::DOUBLE(4.5), - neug::execution::Value::INT64(2023)}, - edge_prop)); + EXPECT_TRUE(interface.AddEdge( + person_label, p1_vid, software_label, software_vid, dev_label, + {neug::Value::DOUBLE(4.5), neug::Value::INT64(2023)}, edge_prop)); EXPECT_TRUE(interface.AddEdge(person_label, p1_vid, cmp_label, cmp_vid, employ_label, {}, edge_prop)); } @@ -201,18 +197,18 @@ class UpdateTransactionTest : public ::testing::Test { neug::StorageTPUpdateInterface& graph, int num_edges) { auto person_label = graph.schema().get_vertex_label_id("person"); auto software_label = graph.schema().get_vertex_label_id("software"); - std::vector> edge_props = { - std::make_pair("review", neug::execution::Value::STRING( - std::string("no review")))}; + std::vector> edge_props = { + std::make_pair("review", + neug::Value::STRING(std::string("no review")))}; EXPECT_TRUE(graph.CreateEdgeType(BuildCreateEdgeTypeParam( "person", "software", "reviewed", edge_props))); neug::label_t review_label = graph.schema().get_edge_label_id("reviewed"); neug::vid_t p1_vid; - EXPECT_TRUE(graph.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + graph.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); neug::vid_t s1_vid; - EXPECT_TRUE(graph.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), s1_vid)); + EXPECT_TRUE( + graph.GetVertexIndex(software_label, neug::Value::INT64(1), s1_vid)); std::string review_text("Review number: "); std::vector reviews; for (int i = 0; i < num_edges; i++) { @@ -221,8 +217,7 @@ class UpdateTransactionTest : public ::testing::Test { const void* edge_prop = nullptr; EXPECT_TRUE(graph.AddEdge( person_label, p1_vid, software_label, s1_vid, review_label, - {neug::execution::Value::STRING(std::string(full_review))}, - edge_prop)); + {neug::Value::STRING(std::string(full_review))}, edge_prop)); } return reviews; } @@ -262,8 +257,7 @@ class UpdateTransactionTest : public ::testing::Test { static neug::CreateVertexTypeParam BuildCreateVertexTypeParam( const std::string& vertex_type, - const std::vector>& - properties, + const std::vector>& properties, const std::vector& primary_keys) { neug::CreateVertexTypeParamBuilder builder; return builder.VertexLabel(vertex_type) @@ -275,8 +269,7 @@ class UpdateTransactionTest : public ::testing::Test { static neug::CreateEdgeTypeParam BuildCreateEdgeTypeParam( const std::string& src_type, const std::string& dst_type, const std::string& edge_type, - const std::vector>& - properties, + const std::vector>& properties, neug::EdgeStrategy oe_strategy = neug::EdgeStrategy::kMultiple, neug::EdgeStrategy ie_strategy = neug::EdgeStrategy::kMultiple) { neug::CreateEdgeTypeParamBuilder builder; @@ -291,8 +284,7 @@ class UpdateTransactionTest : public ::testing::Test { static neug::AddVertexPropertiesParam BuildAddVertexPropertiesParam( const std::string& vertex_type, - const std::vector>& - properties) { + const std::vector>& properties) { neug::AddVertexPropertiesParamBuilder builder; return builder.VertexLabel(vertex_type).Properties(properties).Build(); } @@ -300,8 +292,7 @@ class UpdateTransactionTest : public ::testing::Test { static neug::AddEdgePropertiesParam BuildAddEdgePropertiesParam( const std::string& src_type, const std::string& dst_type, const std::string& edge_type, - const std::vector>& - properties) { + const std::vector>& properties) { neug::AddEdgePropertiesParamBuilder builder; return builder.SrcLabel(src_type) .DstLabel(dst_type) @@ -365,11 +356,10 @@ TEST_F(UpdateTransactionTest, AddVertex) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid)); + EXPECT_TRUE(gui.AddVertex( + person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), neug::Value::INT64(28)}, + vid)); EXPECT_TRUE(txn.Commit()); } { @@ -397,11 +387,10 @@ TEST_F(UpdateTransactionTest, AddVertexBatch) { auto person_label = txn.schema().get_vertex_label_id("person"); for (int i = 4; i <= 10000; i++) { neug::vid_t vid; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(i), - {neug::execution::Value::STRING(std::string("User")), - neug::execution::Value::INT64(20 + i % 10)}, - vid)); + EXPECT_TRUE(gui.AddVertex(person_label, neug::Value::INT64(i), + {neug::Value::STRING(std::string("User")), + neug::Value::INT64(20 + i % 10)}, + vid)); } EXPECT_TRUE(txn.Commit()); } @@ -429,17 +418,14 @@ TEST_F(UpdateTransactionTest, AddEdge) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); neug::vid_t vid2; - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(2), vid2)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(2), vid2)); const void* edge_prop = nullptr; - EXPECT_TRUE(gui.AddEdge(person_label, vid, software_label, vid2, - created_label, - {neug::execution::Value::DOUBLE(0.9), - neug::execution::Value::INT64(2022)}, - edge_prop)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid, software_label, vid2, created_label, + {neug::Value::DOUBLE(0.9), neug::Value::INT64(2022)}, edge_prop)); EXPECT_TRUE(txn.Commit()); } { @@ -482,35 +468,27 @@ TEST_F(UpdateTransactionTest, AddVertexEdge) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid2, vid4, vid3; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(4), - {neug::execution::Value::STRING(std::string("David")), - neug::execution::Value::INT64(32)}, - vid4)); - EXPECT_TRUE( - gui.AddVertex(software_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("NeugDB")), - neug::execution::Value::STRING(std::string("C++"))}, - vid3)); + EXPECT_TRUE(gui.AddVertex( + person_label, neug::Value::INT64(4), + {neug::Value::STRING(std::string("David")), neug::Value::INT64(32)}, + vid4)); + EXPECT_TRUE(gui.AddVertex(software_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("NeugDB")), + neug::Value::STRING(std::string("C++"))}, + vid3)); const void* edge_prop = nullptr; - EXPECT_TRUE(gui.AddEdge(person_label, vid4, software_label, vid3, - created_label, - {neug::execution::Value::DOUBLE(0.85), - neug::execution::Value::INT64(2023)}, - edge_prop)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), vid2)); - EXPECT_TRUE(gui.AddEdge(person_label, vid2, software_label, vid3, - created_label, - {neug::execution::Value::DOUBLE(0.75), - neug::execution::Value::INT64(2021)}, - edge_prop)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid4, software_label, vid3, created_label, + {neug::Value::DOUBLE(0.85), neug::Value::INT64(2023)}, edge_prop)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid2)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid2, software_label, vid3, created_label, + {neug::Value::DOUBLE(0.75), neug::Value::INT64(2021)}, edge_prop)); neug::vid_t vid1; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid1)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid1)); EXPECT_TRUE(gui.AddEdge(person_label, vid4, person_label, vid1, txn.schema().get_edge_label_id("knows"), - {neug::execution::Value::DOUBLE(0.95)}, edge_prop)); + {neug::Value::DOUBLE(0.95)}, edge_prop)); EXPECT_TRUE(txn.Commit()); } { @@ -524,14 +502,14 @@ TEST_F(UpdateTransactionTest, AddVertexEdge) { auto created_label = gi.schema().get_edge_label_id("created"); auto knows_label = gi.schema().get_edge_label_id("knows"); neug::vid_t david_vid; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(4), david_vid)); + EXPECT_TRUE( + gi.GetVertexIndex(person_label, neug::Value::INT64(4), david_vid)); EXPECT_EQ(count_edges_filter_src(gi, person_label, software_label, created_label, david_vid, true), 1); neug::vid_t neugdb_vid; - EXPECT_TRUE(gi.GetVertexIndex( - software_label, neug::execution::Value::INT64(3), neugdb_vid)); + EXPECT_TRUE( + gi.GetVertexIndex(software_label, neug::Value::INT64(3), neugdb_vid)); EXPECT_EQ(count_edges_filter_src(gi, software_label, person_label, created_label, neugdb_vid, false), 2); @@ -557,22 +535,18 @@ TEST_F(UpdateTransactionTest, AddVertexEdgeAbort) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid5, vid4; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(5), - {neug::execution::Value::STRING(std::string("Frank")), - neug::execution::Value::INT64(27)}, - vid5)); EXPECT_TRUE(gui.AddVertex( - software_label, neug::execution::Value::INT64(4), - {neug::execution::Value::STRING(std::string("UltraGraph")), - neug::execution::Value::STRING(std::string("Go"))}, - vid4)); + person_label, neug::Value::INT64(5), + {neug::Value::STRING(std::string("Frank")), neug::Value::INT64(27)}, + vid5)); + EXPECT_TRUE(gui.AddVertex(software_label, neug::Value::INT64(4), + {neug::Value::STRING(std::string("UltraGraph")), + neug::Value::STRING(std::string("Go"))}, + vid4)); const void* edge_prop = nullptr; - EXPECT_TRUE(gui.AddEdge(person_label, vid5, software_label, vid4, - created_label, - {neug::execution::Value::DOUBLE(0.65), - neug::execution::Value::INT64(2022)}, - edge_prop)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid5, software_label, vid4, created_label, + {neug::Value::DOUBLE(0.65), neug::Value::INT64(2022)}, edge_prop)); txn.Abort(); } { @@ -611,10 +585,9 @@ TEST_F(UpdateTransactionTest, UpdateVertexProperty) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); gui.UpdateVertexProperty(person_label, vertex_id, 1, - neug::execution::Value::INT64(26)); + neug::Value::INT64(26)); EXPECT_TRUE(txn.Commit()); } @@ -650,15 +623,14 @@ TEST_F(UpdateTransactionTest, UpdateEdgeProperty) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id)); update_edge_property( txn, person_label, software_label, created_label, vertex_id, [](neug::vid_t dst_vid) { return true; }, [&](neug::vid_t dst_vid, int32_t oe_offset, int32_t ie_offset) { gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 0, neug::execution::Value::DOUBLE(0.99)); + 0, neug::Value::DOUBLE(0.99)); }); EXPECT_TRUE(txn.Commit()); @@ -700,11 +672,10 @@ TEST_F(UpdateTransactionTest, AddVertexAbort) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(4), - {neug::execution::Value::STRING(std::string("Charlie")), - neug::execution::Value::INT64(29)}, - vid)); + EXPECT_TRUE(gui.AddVertex( + person_label, neug::Value::INT64(4), + {neug::Value::STRING(std::string("Charlie")), neug::Value::INT64(29)}, + vid)); txn.Abort(); } { @@ -737,16 +708,13 @@ TEST_F(UpdateTransactionTest, AddEdgeAbort) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid2, vid1; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), vid2)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), vid1)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid2)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(1), vid1)); const void* edge_prop = nullptr; - EXPECT_TRUE(gui.AddEdge(person_label, vid2, software_label, vid1, - created_label, - {neug::execution::Value::DOUBLE(0.8), - neug::execution::Value::INT64(2021)}, - edge_prop)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid2, software_label, vid1, created_label, + {neug::Value::DOUBLE(0.8), neug::Value::INT64(2021)}, edge_prop)); txn.Abort(); } { @@ -786,10 +754,9 @@ TEST_F(UpdateTransactionTest, UpdateVertexAbort) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); gui.UpdateVertexProperty(person_label, vertex_id, 1, - neug::execution::Value::INT64(27)); + neug::Value::INT64(27)); txn.Abort(); } { @@ -834,8 +801,7 @@ TEST_F(UpdateTransactionTest, UpdateEdgeAbort) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id)); update_edge_property( txn, person_label, software_label, created_label, vertex_id, @@ -843,10 +809,10 @@ TEST_F(UpdateTransactionTest, UpdateEdgeAbort) { [&](neug::vid_t dst_vid, int32_t oe_offset, int32_t ie_offset) { gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 0, neug::execution::Value::DOUBLE(0.9)); + 0, neug::Value::DOUBLE(0.9)); gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 1, neug::execution::Value::INT64(2023)); + 1, neug::Value::INT64(2023)); }); txn.Abort(); @@ -930,8 +896,7 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithIntraLabelEdgeAbort) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid2; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vid2)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid2)); EXPECT_TRUE(gui.DeleteVertex(person_label, vid2)); txn.Abort(); } @@ -994,9 +959,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenInsertVertex) { // on a 1-column table -> crash. auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE(interface.AddVertex(person_label, - neug::execution::Value::INT64(3), - {neug::execution::Value::INT64(28)}, vid)); + EXPECT_TRUE(interface.AddVertex(person_label, neug::Value::INT64(3), + {neug::Value::INT64(28)}, vid)); EXPECT_TRUE(txn.Commit()); } @@ -1009,8 +973,7 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenInsertVertex) { EXPECT_EQ(gi.GetVertexPropColumn(person_label, "name"), nullptr); EXPECT_EQ(count_vertices(gi, person_label), 3); neug::vid_t vid; - ASSERT_TRUE( - gi.GetVertexIndex(person_label, neug::execution::Value::INT64(3), vid)); + ASSERT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(3), vid)); auto age_col = std::dynamic_pointer_cast< neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "age")); @@ -1037,23 +1000,20 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { auto sess = svc->AcquireSession(); auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface gui(txn); - std::vector> new_props = { - std::make_pair("email", - neug::execution::Value::STRING(std::string(""))), - std::make_pair("score", neug::execution::Value::DOUBLE(0.0))}; + std::vector> new_props = { + std::make_pair("email", neug::Value::STRING(std::string(""))), + std::make_pair("score", neug::Value::DOUBLE(0.0))}; EXPECT_TRUE(gui.AddVertexProperties( BuildAddVertexPropertiesParam("person", new_props))); // Set initial values for person id=1 auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); // name(0), age(1), email(2), score(3) gui.UpdateVertexProperty( person_label, vid, 2, - neug::execution::Value::STRING(std::string("alice@test.com"))); - gui.UpdateVertexProperty(person_label, vid, 3, - neug::execution::Value::DOUBLE(95.5)); + neug::Value::STRING(std::string("alice@test.com"))); + gui.UpdateVertexProperty(person_label, vid, 3, neug::Value::DOUBLE(95.5)); EXPECT_TRUE(txn.Commit()); } @@ -1073,12 +1033,11 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { neug::StorageTPUpdateInterface interface(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); // Step 1: update "age" (col 1) to trigger detachment interface.UpdateVertexProperty(person_label, vid, 1, - neug::execution::Value::INT64(31)); + neug::Value::INT64(31)); // Step 2: delete "name" (col 0) — shifts column indices EXPECT_TRUE(interface.DeleteVertexProperties( @@ -1087,10 +1046,9 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { // After deletion: age(0), email(1), score(2) — 3 non-PK columns // Step 3: update remaining properties with shifted indices interface.UpdateVertexProperty( - person_label, vid, 1, - neug::execution::Value::STRING(std::string("new@test.com"))); + person_label, vid, 1, neug::Value::STRING(std::string("new@test.com"))); interface.UpdateVertexProperty(person_label, vid, 2, - neug::execution::Value::DOUBLE(88.0)); + neug::Value::DOUBLE(88.0)); // Step 4: insert a new vertex — without the fix, // detachVertexTableForInsert iterates stale columns_detached @@ -1098,10 +1056,10 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { // out-of-bounds crash. neug::vid_t new_vid; EXPECT_TRUE(interface.AddVertex( - person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::INT64(22), - neug::execution::Value::STRING(std::string("charlie@test.com")), - neug::execution::Value::DOUBLE(77.0)}, + person_label, neug::Value::INT64(3), + {neug::Value::INT64(22), + neug::Value::STRING(std::string("charlie@test.com")), + neug::Value::DOUBLE(77.0)}, new_vid)); EXPECT_TRUE(txn.Commit()); } @@ -1119,8 +1077,7 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { // person id=1: age=31, email=new@test.com, score=88.0 { neug::vid_t vid; - CHECK(gi.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); auto age_col = std::dynamic_pointer_cast< neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "age")); @@ -1142,8 +1099,7 @@ TEST_F(UpdateTransactionTest, DeleteVertexPropertiesThenUpdateRemaining) { // person id=3: age=22, email=charlie@test.com, score=77.0 { neug::vid_t vid; - CHECK(gi.GetVertexIndex(person_label, neug::execution::Value::INT64(3), - vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(3), vid)); auto age_col = std::dynamic_pointer_cast< neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "age")); @@ -1171,8 +1127,8 @@ TEST_F(UpdateTransactionTest, DeleteEdgePropertiesThenInsertEdge) { auto sess = svc->AcquireSession(); auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface gui(txn); - std::vector> new_props = { - std::make_pair("rating", neug::execution::Value::DOUBLE(0.0))}; + std::vector> new_props = { + std::make_pair("rating", neug::Value::DOUBLE(0.0))}; EXPECT_TRUE(gui.AddEdgeProperties(BuildAddEdgePropertiesParam( "person", "software", "created", new_props))); EXPECT_TRUE(txn.Commit()); @@ -1196,16 +1152,12 @@ TEST_F(UpdateTransactionTest, DeleteEdgePropertiesThenInsertEdge) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t p1_vid, s1_vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - p1_vid)); - CHECK(txn.GetVertexIndex(software_label, neug::execution::Value::INT64(1), - s1_vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + CHECK(txn.GetVertexIndex(software_label, neug::Value::INT64(1), s1_vid)); const void* edge_prop = nullptr; - EXPECT_TRUE(interface.AddEdge(person_label, p1_vid, software_label, s1_vid, - created_label, - {neug::execution::Value::DOUBLE(0.9), - neug::execution::Value::DOUBLE(4.5)}, - edge_prop)); + EXPECT_TRUE(interface.AddEdge( + person_label, p1_vid, software_label, s1_vid, created_label, + {neug::Value::DOUBLE(0.9), neug::Value::DOUBLE(4.5)}, edge_prop)); EXPECT_TRUE(txn.Commit()); } @@ -1232,16 +1184,15 @@ TEST_F(UpdateTransactionTest, DeleteEdgePropertiesThenInsertEdge) { auto view = gi.GetGenericOutgoingGraphView(person_label, software_label, created_label); neug::vid_t p1_vid; - CHECK(gi.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - p1_vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); int edge_count = 0; auto edge_iter = view.get_edges(p1_vid); for (auto it = edge_iter.begin(); it != edge_iter.end(); ++it) { edge_count++; if (it.get_vertex() == [&]() { neug::vid_t s1_vid; - CHECK(gi.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), s1_vid)); + CHECK(gi.GetVertexIndex(software_label, neug::Value::INT64(1), + s1_vid)); return s1_vid; }()) { // One of the edges to software(1) should have the new values @@ -1277,10 +1228,9 @@ TEST_F(UpdateTransactionTest, DeleteVertexTypeWithEdgesThenCreateNewTypes) { EXPECT_TRUE(interface.DeleteVertexType("software")); // Create a new vertex type "company" and edge type "employed_by" - std::vector> v_props = { - std::make_pair("id", neug::execution::Value::INT64(0)), - std::make_pair("name", - neug::execution::Value::STRING(std::string("")))}; + std::vector> v_props = { + std::make_pair("id", neug::Value::INT64(0)), + std::make_pair("name", neug::Value::STRING(std::string("")))}; EXPECT_TRUE(interface.CreateVertexType( BuildCreateVertexTypeParam("company", v_props, {"id"}))); EXPECT_TRUE(interface.CreateEdgeType( @@ -1290,14 +1240,13 @@ TEST_F(UpdateTransactionTest, DeleteVertexTypeWithEdgesThenCreateNewTypes) { auto company_label = interface.schema().get_vertex_label_id("company"); neug::vid_t cmp_vid; EXPECT_TRUE(interface.AddVertex( - company_label, neug::execution::Value::INT64(1), - {neug::execution::Value::STRING(std::string("TechCorp"))}, cmp_vid)); + company_label, neug::Value::INT64(1), + {neug::Value::STRING(std::string("TechCorp"))}, cmp_vid)); auto person_label = interface.schema().get_vertex_label_id("person"); auto employ_label = interface.schema().get_edge_label_id("employed_by"); neug::vid_t p1_vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - p1_vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); const void* edge_prop = nullptr; EXPECT_TRUE(interface.AddEdge(person_label, p1_vid, company_label, cmp_vid, employ_label, {}, edge_prop)); @@ -1344,8 +1293,8 @@ TEST_F(UpdateTransactionTest, DeleteEdgeTypeThenCreateNewEdgeType) { EXPECT_TRUE(interface.DeleteEdgeType("person", "person", "knows")); // Create a new edge type "friend_of" between person and person - std::vector> e_props = { - std::make_pair("closeness", neug::execution::Value::DOUBLE(0.0))}; + std::vector> e_props = { + std::make_pair("closeness", neug::Value::DOUBLE(0.0))}; EXPECT_TRUE(interface.CreateEdgeType( BuildCreateEdgeTypeParam("person", "person", "friend_of", e_props))); @@ -1353,14 +1302,12 @@ TEST_F(UpdateTransactionTest, DeleteEdgeTypeThenCreateNewEdgeType) { auto person_label = interface.schema().get_vertex_label_id("person"); auto friend_label = interface.schema().get_edge_label_id("friend_of"); neug::vid_t p1_vid, p2_vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - p1_vid)); - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - p2_vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), p2_vid)); const void* edge_prop = nullptr; - EXPECT_TRUE(interface.AddEdge( - person_label, p1_vid, person_label, p2_vid, friend_label, - {neug::execution::Value::DOUBLE(0.75)}, edge_prop)); + EXPECT_TRUE(interface.AddEdge(person_label, p1_vid, person_label, p2_vid, + friend_label, {neug::Value::DOUBLE(0.75)}, + edge_prop)); EXPECT_TRUE(txn.Commit()); } @@ -1383,8 +1330,7 @@ TEST_F(UpdateTransactionTest, DeleteEdgeTypeThenCreateNewEdgeType) { auto view = gi.GetGenericOutgoingGraphView(person_label, person_label, friend_label); neug::vid_t p1_vid; - CHECK(gi.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - p1_vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); auto edges = view.get_edges(p1_vid); for (auto it = edges.begin(); it != edges.end(); ++it) { EXPECT_EQ(ed_accessor.get_data(it).GetValue(), 0.75); @@ -1407,8 +1353,7 @@ TEST_F(UpdateTransactionTest, UpdateEdgeAbort2) { auto person_label = txn.schema().get_vertex_label_id("person"); auto knows_label = txn.schema().get_edge_label_id("knows"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id)); update_edge_property( txn, person_label, person_label, knows_label, vertex_id, @@ -1416,7 +1361,7 @@ TEST_F(UpdateTransactionTest, UpdateEdgeAbort2) { [&](neug::vid_t dst_vid, int32_t oe_offset, int32_t ie_offset) { gui.UpdateEdgeProperty(person_label, vertex_id, person_label, dst_vid, knows_label, oe_offset, ie_offset, 0, - neug::execution::Value::DOUBLE(0.95)); + neug::Value::DOUBLE(0.95)); }); txn.Abort(); @@ -1474,19 +1419,15 @@ TEST_F(UpdateTransactionTest, AddEdgeAndUpdateAndAbort) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid1, vid2; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid1)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(2), vid2)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid1)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(2), vid2)); const void* edge_prop = nullptr; - EXPECT_TRUE(gui.AddEdge(person_label, vid1, software_label, vid2, - created_label, - {neug::execution::Value::DOUBLE(0.85), - neug::execution::Value::INT64(2023)}, - edge_prop)); + EXPECT_TRUE(gui.AddEdge( + person_label, vid1, software_label, vid2, created_label, + {neug::Value::DOUBLE(0.85), neug::Value::INT64(2023)}, edge_prop)); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id)); update_edge_property( txn, person_label, software_label, created_label, vertex_id, @@ -1494,7 +1435,7 @@ TEST_F(UpdateTransactionTest, AddEdgeAndUpdateAndAbort) { [&](neug::vid_t dst_vid, int32_t oe_offset, int32_t ie_offset) { gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 0, neug::execution::Value::DOUBLE(0.9)); + 0, neug::Value::DOUBLE(0.9)); }); txn.Abort(); @@ -1545,8 +1486,7 @@ TEST_F(UpdateTransactionTest, DeleteVertex) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); EXPECT_TRUE(gui.DeleteVertex(person_label, vertex_id)); EXPECT_TRUE(txn.Commit()); } @@ -1559,8 +1499,8 @@ TEST_F(UpdateTransactionTest, DeleteVertex) { auto software_label = gi.schema().get_vertex_label_id("software"); EXPECT_EQ(count_vertices(gi, person_label), 1); neug::vid_t vertex_id; - EXPECT_FALSE(gi.GetVertexIndex( - person_label, neug::execution::Value::INT64(2), vertex_id)); + EXPECT_FALSE( + gi.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); EXPECT_EQ( count_edges(gi, person_label, software_label, created_label, true), 1); EXPECT_EQ( @@ -1574,9 +1514,9 @@ TEST_F(UpdateTransactionTest, DeleteVertex) { auto person_label = txn.schema().get_vertex_label_id("person"); EXPECT_TRUE(gui.DeleteVertexType("person")); neug::vid_t vertex_id; - EXPECT_THROW(txn.GetVertexIndex( - person_label, neug::execution::Value::INT64(1), vertex_id), - neug::exception::Exception); + EXPECT_THROW( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id), + neug::exception::Exception); } db.Close(); } @@ -1596,10 +1536,9 @@ TEST_F(UpdateTransactionTest, DeleteEdgeAbort) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vid2, vid1; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid2)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), vid1)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid2)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(1), vid1)); EXPECT_TRUE(gui.DeleteEdges(person_label, vid2, software_label, vid1, created_label)); EXPECT_TRUE(txn.Commit()); @@ -1611,10 +1550,8 @@ TEST_F(UpdateTransactionTest, DeleteEdgeAbort) { auto person_label = txn.schema().get_vertex_label_id("person"); auto knows_label = txn.schema().get_edge_label_id("knows"); neug::vid_t vid1, vid2; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid1)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), vid2)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid1)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid2)); EXPECT_TRUE( gui.DeleteEdges(person_label, vid1, person_label, vid2, knows_label)); txn.Abort(); @@ -1626,10 +1563,8 @@ TEST_F(UpdateTransactionTest, DeleteEdgeAbort) { auto person_label = txn.schema().get_vertex_label_id("person"); auto knows_label = txn.schema().get_edge_label_id("knows"); neug::vid_t vid1, vid2; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), vid1)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), vid2)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid1)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid2)); auto oe_edges = txn.GetGenericOutgoingGraphView(person_label, person_label, knows_label) .get_edges(vid1); @@ -1691,15 +1626,13 @@ TEST_F(UpdateTransactionTest, AddDeleteVertexAbort) { neug::StorageTPUpdateInterface interface(txn); auto person_label = interface.schema().get_vertex_label_id("person"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); EXPECT_TRUE(interface.DeleteVertex(person_label, vertex_id)); neug::vid_t vid; - EXPECT_TRUE( - interface.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid)); + EXPECT_TRUE(interface.AddVertex( + person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), neug::Value::INT64(28)}, + vid)); txn.Abort(); } { @@ -1709,10 +1642,10 @@ TEST_F(UpdateTransactionTest, AddDeleteVertexAbort) { auto person_label = gi.schema().get_vertex_label_id("person"); EXPECT_EQ(count_vertices(gi, person_label), 2); neug::vid_t vertex_id; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), vertex_id)); - EXPECT_FALSE(gi.GetVertexIndex( - person_label, neug::execution::Value::INT64(3), vertex_id)); + EXPECT_TRUE( + gi.GetVertexIndex(person_label, neug::Value::INT64(2), vertex_id)); + EXPECT_FALSE( + gi.GetVertexIndex(person_label, neug::Value::INT64(3), vertex_id)); } { // Add again @@ -1721,11 +1654,10 @@ TEST_F(UpdateTransactionTest, AddDeleteVertexAbort) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE( - gui.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid)); + EXPECT_TRUE(gui.AddVertex( + person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), neug::Value::INT64(28)}, + vid)); EXPECT_TRUE(txn.Commit()); } { @@ -1735,8 +1667,8 @@ TEST_F(UpdateTransactionTest, AddDeleteVertexAbort) { auto person_label = gi.schema().get_vertex_label_id("person"); EXPECT_EQ(count_vertices(gi, person_label), 3); neug::vid_t vertex_id; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(3), vertex_id)); + EXPECT_TRUE( + gi.GetVertexIndex(person_label, neug::Value::INT64(3), vertex_id)); EXPECT_EQ(count_vertices(gi, person_label), 3); } db.Close(); @@ -1859,19 +1791,17 @@ TEST_F(UpdateTransactionTest, AddVertexProperties) { auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); - std::vector> new_props = { - std::make_pair("email", - neug::execution::Value::STRING(std::string(""))), - std::make_pair("height", neug::execution::Value::DOUBLE(0.0))}; + std::vector> new_props = { + std::make_pair("email", neug::Value::STRING(std::string(""))), + std::make_pair("height", neug::Value::DOUBLE(0.0))}; EXPECT_TRUE(gui.AddVertexProperties( BuildAddVertexPropertiesParam("person", new_props))); auto email_accessor = txn.get_vertex_property_column(person_label, "email"); neug::vid_t vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vid)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); gui.UpdateVertexProperty( person_label, vid, 2, - neug::execution::Value::STRING(std::string("eve@example.com"))); + neug::Value::STRING(std::string("eve@example.com"))); EXPECT_TRUE(txn.Commit()); } { @@ -1881,16 +1811,13 @@ TEST_F(UpdateTransactionTest, AddVertexProperties) { auto person_label = txn.schema().get_vertex_label_id("person"); auto height_accessor = txn.get_vertex_property_column(person_label, "height"); - std::vector> new_props = { - std::make_pair("address", - neug::execution::Value::STRING(std::string("")))}; + std::vector> new_props = { + std::make_pair("address", neug::Value::STRING(std::string("")))}; EXPECT_TRUE(gui.AddVertexProperties( BuildAddVertexPropertiesParam("person", new_props))); neug::vid_t vid; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(2), - vid)); - gui.UpdateVertexProperty(person_label, vid, 3, - neug::execution::Value::DOUBLE(175.5)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(2), vid)); + gui.UpdateVertexProperty(person_label, vid, 3, neug::Value::DOUBLE(175.5)); txn.Abort(); } { @@ -1907,12 +1834,10 @@ TEST_F(UpdateTransactionTest, AddVertexProperties) { neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "height")); neug::vid_t vid; - CHECK( - gi.GetVertexIndex(person_label, neug::execution::Value::INT64(1), vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(1), vid)); EXPECT_EQ(email_accessor->get_any(vid).GetValue(), "eve@example.com"); - CHECK( - gi.GetVertexIndex(person_label, neug::execution::Value::INT64(2), vid)); + CHECK(gi.GetVertexIndex(person_label, neug::Value::INT64(2), vid)); EXPECT_EQ(height_accessor->get_any(vid).GetValue(), 0.0); } db.Close(); @@ -1929,10 +1854,9 @@ TEST_F(UpdateTransactionTest, AddEdgeProperties) { auto sess = svc->AcquireSession(); auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface interface(txn); - std::vector> new_props = { - std::make_pair("version", neug::execution::Value::INT64(0)), - std::make_pair("license", - neug::execution::Value::STRING(std::string("")))}; + std::vector> new_props = { + std::make_pair("version", neug::Value::INT64(0)), + std::make_pair("license", neug::Value::STRING(std::string("")))}; EXPECT_TRUE(interface.AddEdgeProperties(BuildAddEdgePropertiesParam( "person", "software", "created", new_props))); EXPECT_TRUE(txn.Commit()); @@ -1941,8 +1865,8 @@ TEST_F(UpdateTransactionTest, AddEdgeProperties) { auto sess = svc->AcquireSession(); auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface interface(txn); - std::vector> new_props = { - std::make_pair("contributions", neug::execution::Value::DOUBLE(0.0))}; + std::vector> new_props = { + std::make_pair("contributions", neug::Value::DOUBLE(0.0))}; EXPECT_TRUE(interface.AddEdgeProperties(BuildAddEdgePropertiesParam( "person", "software", "created", new_props))); txn.Abort(); @@ -2085,8 +2009,8 @@ TEST_F(UpdateTransactionTest, DeleteEdgeProperties) { neug::StorageTPUpdateInterface interface(txn); EXPECT_TRUE(interface.DeleteEdgeProperties(BuildDeleteEdgePropertiesParam( "person", "software", "created", {"since"}))); - std::vector> new_props = { - std::make_pair("contributions", neug::execution::Value::DOUBLE(0.0))}; + std::vector> new_props = { + std::make_pair("contributions", neug::Value::DOUBLE(0.0))}; LOG(INFO) << "Adding new edge property 'contributions'."; EXPECT_TRUE(interface.AddEdgeProperties(BuildAddEdgePropertiesParam( "person", "software", "created", new_props))); @@ -2158,9 +2082,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexProperties) { BuildDeleteVertexPropertiesParam("person", {"age"}))); EXPECT_TRUE(interface.DeleteVertexProperties( BuildDeleteVertexPropertiesParam("software", {"lang"}))); - std::vector> new_props = { - std::make_pair("authors", - neug::execution::Value::STRING(std::string("")))}; + std::vector> new_props = { + std::make_pair("authors", neug::Value::STRING(std::string("")))}; EXPECT_TRUE(interface.AddVertexProperties( BuildAddVertexPropertiesParam("software", new_props))); EXPECT_TRUE(txn.Commit()); @@ -2205,29 +2128,25 @@ TEST_F(UpdateTransactionTest, TestReplayWal) { neug::StorageTPUpdateInterface interface(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t vid; - EXPECT_TRUE( - interface.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid)); + EXPECT_TRUE(interface.AddVertex( + person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), neug::Value::INT64(28)}, + vid)); EXPECT_TRUE(interface.CreateVertexType(BuildCreateVertexTypeParam( "company", - {std::make_pair("id", neug::execution::Value::INT64(0)), - std::make_pair("name", - neug::execution::Value::STRING(std::string("")))}, + {std::make_pair("id", neug::Value::INT64(0)), + std::make_pair("name", neug::Value::STRING(std::string("")))}, {"id"}))); EXPECT_TRUE(interface.CreateEdgeType( BuildCreateEdgeTypeParam("person", "company", "employed_by", {}))); EXPECT_TRUE(interface.DeleteEdgeType("person", "software", "created")); EXPECT_TRUE(interface.DeleteVertexType("software")); neug::vid_t src_p, dst_p; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), src_p)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), dst_p)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(1), src_p)); + EXPECT_TRUE(txn.GetVertexIndex(person_label, neug::Value::INT64(2), dst_p)); interface.UpdateVertexProperty(person_label, src_p, 1, - neug::execution::Value::INT64(29)); + neug::Value::INT64(29)); update_edge_property( txn, person_label, person_label, txn.schema().get_edge_label_id("knows"), src_p, @@ -2236,7 +2155,7 @@ TEST_F(UpdateTransactionTest, TestReplayWal) { interface.UpdateEdgeProperty(person_label, src_p, person_label, dst_p, txn.schema().get_edge_label_id("knows"), oe_offset, ie_offset, 0, - neug::execution::Value::DOUBLE(0.5)); + neug::Value::DOUBLE(0.5)); }); EXPECT_TRUE(txn.Commit()); db.Close(); @@ -2251,10 +2170,8 @@ TEST_F(UpdateTransactionTest, TestReplayWal) { auto person_label = gi.schema().get_vertex_label_id("person"); EXPECT_EQ(count_vertices(gi, person_label), 3); neug::vid_t src_p, dst_p; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), src_p)); - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), dst_p)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(1), src_p)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(2), dst_p)); auto vprop_accessor = std::dynamic_pointer_cast< neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "age")); @@ -2292,10 +2209,8 @@ TEST_F(UpdateTransactionTest, TestReplayWal) { auto person_label = gi.schema().get_vertex_label_id("person"); auto knows_label = gi.schema().get_edge_label_id("knows"); neug::vid_t src_p, dst_p; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), src_p)); - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), dst_p)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(1), src_p)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(2), dst_p)); auto ed_accessor = gi.GetEdgeDataAccessor(person_label, person_label, knows_label, 0); auto view = @@ -2323,24 +2238,21 @@ TEST_F(UpdateTransactionTest, TestAPIAfterDeleteVertexLabel) { auto person_label = txn.schema().get_vertex_label_id("person"); EXPECT_TRUE(interface.DeleteVertexType("person")); neug::vid_t vid; - EXPECT_THROW( - txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), vid), - neug::exception::Exception); - EXPECT_THROW( - interface.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid), - neug::exception::Exception); - EXPECT_THROW(interface.UpdateVertexProperty( - person_label, 0, 1, neug::execution::Value::INT64(30)), + EXPECT_THROW(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vid), + neug::exception::Exception); + EXPECT_THROW(interface.AddVertex(person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), + neug::Value::INT64(28)}, + vid), + neug::exception::Exception); + EXPECT_THROW(interface.UpdateVertexProperty(person_label, 0, 1, + neug::Value::INT64(30)), + neug::exception::Exception); + EXPECT_THROW(interface.AddVertex(person_label, neug::Value::INT64(3), + {neug::Value::STRING(std::string("Eve")), + neug::Value::INT64(28)}, + vid), neug::exception::Exception); - EXPECT_THROW( - interface.AddVertex(person_label, neug::execution::Value::INT64(3), - {neug::execution::Value::STRING(std::string("Eve")), - neug::execution::Value::INT64(28)}, - vid), - neug::exception::Exception); EXPECT_THROW(interface.DeleteVertex(person_label, 0), neug::exception::Exception); txn.Abort(); @@ -2364,8 +2276,8 @@ TEST_F(UpdateTransactionTest, TestAPIAfterDeleteVertexLabel) { EXPECT_EQ(txn.get_vertex_property_column(person_label, "age"), nullptr); // add back age property - std::vector> new_props = { - std::make_pair("age", neug::execution::Value::INT32(0))}; + std::vector> new_props = { + std::make_pair("age", neug::Value::INT32(0))}; EXPECT_NO_THROW(interface.AddVertexProperties( BuildAddVertexPropertiesParam("person", new_props))); EXPECT_NO_THROW(txn.get_vertex_property_column(person_label, "age")); @@ -2389,10 +2301,10 @@ TEST_F(UpdateTransactionTest, TestAPIAfterDeleteEdgeLabel) { auto person_label = interface.schema().get_vertex_label_id("person"); auto knows_label = interface.schema().get_edge_label_id("knows"); neug::vid_t src_vid, dst_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), src_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), dst_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), src_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), dst_vid)); int32_t oe_offset = -1, ie_offset = -1; { auto oe_view = interface.GetGenericOutgoingGraphView( @@ -2420,14 +2332,13 @@ TEST_F(UpdateTransactionTest, TestAPIAfterDeleteEdgeLabel) { EXPECT_FALSE(interface.UpdateEdgeProperty( person_label, src_vid, person_label, dst_vid, knows_label,0,0, - 0, neug::execution::Value::DOUBLE(0.8)).ok()); + 0, neug::Value::DOUBLE(0.8)).ok()); { const void* edge_prop = nullptr; EXPECT_THROW( interface.AddEdge(person_label, src_vid, person_label, dst_vid, - knows_label, {neug::execution::Value::DOUBLE(0.7)}, - edge_prop), + knows_label, {neug::Value::DOUBLE(0.7)}, edge_prop), neug::exception::Exception); } EXPECT_THROW(txn.GetGenericOutgoingGraphView(person_label, person_label, @@ -2454,10 +2365,10 @@ TEST_F(UpdateTransactionTest, TestAPIAfterDeleteEdgeLabel) { "person", "person", "knows", {std::make_pair("closeness", "importance")}))); neug::vid_t src_vid, dst_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), src_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), dst_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), src_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), dst_vid)); EXPECT_THROW( txn.GetEdgeDataAccessor(person_label, person_label, knows_label, 0), neug::exception::Exception); @@ -2479,8 +2390,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithOutgoingEdges) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t p1_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_TRUE(gui.DeleteVertex(person_label, p1_vid)); EXPECT_TRUE(txn.Commit()); } @@ -2494,8 +2405,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithOutgoingEdges) { auto knows_label = gi.schema().get_edge_label_id("knows"); neug::vid_t p1_vid; - EXPECT_FALSE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_FALSE( + gi.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_EQ(count_vertices(gi, person_label), 1); EXPECT_EQ( count_edges(gi, person_label, software_label, created_label, true), 1); @@ -2519,13 +2430,13 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithBidirectionalEdges) { auto person_label = txn.schema().get_vertex_label_id("person"); auto knows_label = txn.schema().get_edge_label_id("knows"); neug::vid_t p1_vid, p2_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), p2_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), p2_vid)); const void* edge_prop_p2_p1 = nullptr; EXPECT_TRUE(gui.AddEdge(person_label, p2_vid, person_label, p1_vid, - knows_label, {neug::execution::Value::DOUBLE(0.85)}, + knows_label, {neug::Value::DOUBLE(0.85)}, edge_prop_p2_p1)); EXPECT_TRUE(txn.Commit()); } @@ -2544,8 +2455,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithBidirectionalEdges) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t p1_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_TRUE(gui.DeleteVertex(person_label, p1_vid)); EXPECT_TRUE(txn.Commit()); } @@ -2580,10 +2491,10 @@ TEST_F(UpdateTransactionTest, DeleteVertexAbortRestoresEdges) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t p1_vid, p2_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), p2_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(1), p2_vid)); auto oe_view = txn.GetGenericOutgoingGraphView(person_label, software_label, created_label); auto ie_view = txn.GetGenericIncomingGraphView(software_label, person_label, @@ -2626,8 +2537,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexAbortRestoresEdges) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t p1_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_TRUE(gui.DeleteVertex(person_label, p1_vid)); txn.Abort(); } @@ -2641,8 +2552,7 @@ TEST_F(UpdateTransactionTest, DeleteVertexAbortRestoresEdges) { auto created_label = gi.schema().get_edge_label_id("created"); auto knows_label = gi.schema().get_edge_label_id("knows"); neug::vid_t p1_vid; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_EQ(count_vertices(gi, person_label), 2); EXPECT_EQ( count_edges(gi, person_label, software_label, created_label, true), @@ -2666,21 +2576,21 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithMultipleEdgeTypes) { auto txn = sess->GetUpdateTransaction(); neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); - std::vector> edge_props = { - std::make_pair("since", neug::execution::Value::INT64(2020))}; + std::vector> edge_props = { + std::make_pair("since", neug::Value::INT64(2020))}; EXPECT_TRUE(gui.CreateEdgeType( BuildCreateEdgeTypeParam("person", "person", "follows", edge_props))); neug::vid_t p1_vid, p2_vid; auto follows_label = txn.schema().get_edge_label_id("follows"); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), p2_vid)); - const void* edge_prop_follows = nullptr; EXPECT_TRUE( - gui.AddEdge(person_label, p1_vid, person_label, p2_vid, follows_label, - {neug::execution::Value::INT64(2022)}, edge_prop_follows)); + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), p2_vid)); + const void* edge_prop_follows = nullptr; + EXPECT_TRUE(gui.AddEdge(person_label, p1_vid, person_label, p2_vid, + follows_label, {neug::Value::INT64(2022)}, + edge_prop_follows)); EXPECT_TRUE(txn.Commit()); } { @@ -2689,8 +2599,8 @@ TEST_F(UpdateTransactionTest, DeleteVertexWithMultipleEdgeTypes) { neug::StorageTPUpdateInterface gui(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t p1_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); EXPECT_TRUE(gui.DeleteVertex(person_label, p1_vid)); EXPECT_TRUE(txn.Commit()); } @@ -2764,10 +2674,10 @@ TEST_F(UpdateTransactionTest, BatchDeleteVertices) { neug::StorageTPUpdateInterface interface(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t alice_vid, bob_vid; - EXPECT_TRUE(txn.GetVertexIndex( - person_label, neug::execution::Value::INT64(1), alice_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), bob_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), alice_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), bob_vid)); std::vector lids = {alice_vid, bob_vid}; EXPECT_EQ(interface.BatchDeleteVertices(person_label, lids).error_code(), neug::StatusCode::OK); @@ -2798,14 +2708,14 @@ TEST_F(UpdateTransactionTest, BatchDeleteEdges) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t p1_vid, p2_vid, s1_vid, s2_vid; - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); - EXPECT_TRUE(txn.GetVertexIndex(person_label, - neug::execution::Value::INT64(2), p2_vid)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(1), s1_vid)); - EXPECT_TRUE(txn.GetVertexIndex(software_label, - neug::execution::Value::INT64(2), s2_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(2), p2_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(1), s1_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(software_label, neug::Value::INT64(2), s2_vid)); std::vector> edges = { std::make_tuple(p1_vid, s1_vid), std::make_tuple(p2_vid, s2_vid)}; EXPECT_EQ(interface.BatchDeleteEdges(person_label, software_label, @@ -2842,8 +2752,8 @@ TEST_F(UpdateTransactionTest, BatchDeleteVerticesFailure) { neug::StorageTPUpdateInterface interface(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t alice_vid; - EXPECT_TRUE(txn.GetVertexIndex( - person_label, neug::execution::Value::INT64(1), alice_vid)); + EXPECT_TRUE( + txn.GetVertexIndex(person_label, neug::Value::INT64(1), alice_vid)); auto invalid_vid = std::numeric_limits::max(); EXPECT_FALSE( interface.BatchDeleteVertices(person_label, {alice_vid, invalid_vid}) @@ -2909,21 +2819,19 @@ TEST_F(UpdateTransactionTest, TestUpdateStringProperty) { neug::StorageTPUpdateInterface interface(txn); auto person_label = txn.schema().get_vertex_label_id("person"); neug::vid_t p1_vid, p2_vid; - EXPECT_TRUE(interface.GetVertexIndex( - person_label, neug::execution::Value::INT64(1), p1_vid)); - EXPECT_TRUE(interface.GetVertexIndex( - person_label, neug::execution::Value::INT64(2), p2_vid)); + EXPECT_TRUE( + interface.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); + EXPECT_TRUE( + interface.GetVertexIndex(person_label, neug::Value::INT64(2), p2_vid)); std::string long_name(neug::STRING_DEFAULT_MAX_LENGTH + 10, 'a'); - interface.UpdateVertexProperty( - person_label, p1_vid, 0, - neug::execution::Value::STRING(std::string(long_name))); + interface.UpdateVertexProperty(person_label, p1_vid, 0, + neug::Value::STRING(std::string(long_name))); auto prop = interface.GetVertexProperty(person_label, p1_vid, 0); EXPECT_EQ(prop.GetValue(), std::string(neug::STRING_DEFAULT_MAX_LENGTH, 'a')); // truncated std::string valid_name(neug::STRING_DEFAULT_MAX_LENGTH - 10, 'b'); EXPECT_NO_THROW(interface.UpdateVertexProperty( - person_label, p1_vid, 0, - neug::execution::Value::STRING(std::string(valid_name)))); + person_label, p1_vid, 0, neug::Value::STRING(std::string(valid_name)))); prop = interface.GetVertexProperty(person_label, p1_vid, 0); EXPECT_EQ(prop.GetValue(), valid_name); auto p2_prop = interface.GetVertexProperty(person_label, p2_vid, 0); @@ -2936,8 +2844,7 @@ TEST_F(UpdateTransactionTest, TestUpdateStringProperty) { neug::StorageReadInterface gi(txn.view(), txn.timestamp()); auto person_label = gi.schema().get_vertex_label_id("person"); neug::vid_t p1_vid; - EXPECT_TRUE(gi.GetVertexIndex(person_label, - neug::execution::Value::INT64(1), p1_vid)); + EXPECT_TRUE(gi.GetVertexIndex(person_label, neug::Value::INT64(1), p1_vid)); auto vprop_accessor = std::dynamic_pointer_cast< neug::StorageReadInterface::vertex_column_t>( gi.GetVertexPropColumn(person_label, "name")); @@ -3016,7 +2923,7 @@ TEST_F(UpdateTransactionTest, TestUpdateEdgeStringPropertyCompact) { interface.UpdateEdgeProperty( person_label, vid, software_label, it.get_vertex(), review_label, oe_offset, ie_offset, 0, - neug::execution::Value::STRING(std::string(updated_review))); + neug::Value::STRING(std::string(updated_review))); updated_views.push_back(updated_review); } } @@ -3081,8 +2988,7 @@ TEST_F(UpdateTransactionTest, TestTPServiceStart) { auto software_label = txn.schema().get_vertex_label_id("software"); auto created_label = txn.schema().get_edge_label_id("created"); neug::vid_t vertex_id; - CHECK(txn.GetVertexIndex(person_label, neug::execution::Value::INT64(1), - vertex_id)); + CHECK(txn.GetVertexIndex(person_label, neug::Value::INT64(1), vertex_id)); update_edge_property( txn, person_label, software_label, created_label, vertex_id, @@ -3090,10 +2996,10 @@ TEST_F(UpdateTransactionTest, TestTPServiceStart) { [&](neug::vid_t dst_vid, int32_t oe_offset, int32_t ie_offset) { gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 0, neug::execution::Value::DOUBLE(0.9)); + 0, neug::Value::DOUBLE(0.9)); gui.UpdateEdgeProperty(person_label, vertex_id, software_label, dst_vid, created_label, oe_offset, ie_offset, - 1, neug::execution::Value::INT64(2023)); + 1, neug::Value::INT64(2023)); }); txn.Abort(); diff --git a/tests/transaction/test_wal_replay.cc b/tests/transaction/test_wal_replay.cc index 8352e3ea2..7f4419751 100644 --- a/tests/transaction/test_wal_replay.cc +++ b/tests/transaction/test_wal_replay.cc @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/neug.h" #include "neug/server/neug_db_service.h" #include "neug/storages/graph/graph_interface.h" @@ -30,7 +30,7 @@ namespace { -using neug::execution::Value; +using neug::Value; std::string make_test_dir() { const auto* info = ::testing::UnitTest::GetInstance()->current_test_info(); diff --git a/tests/unittest/logical_delete_test.cc b/tests/unittest/logical_delete_test.cc index ff544e012..be632c79d 100644 --- a/tests/unittest/logical_delete_test.cc +++ b/tests/unittest/logical_delete_test.cc @@ -15,7 +15,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/property_graph.h" #include "neug/utils/property/types.h" #include "neug/utils/yaml_utils.h" @@ -52,7 +52,7 @@ class PropertyGraphLogicalDeleteTest : public ::testing::Test { CreateVertexTypeParam BuildCreateVertexTypeParam( const std::string& name, - const std::vector>& properties, + const std::vector>& properties, const std::vector& primary_keys) { CreateVertexTypeParamBuilder builder; builder.VertexLabel(name) @@ -64,7 +64,7 @@ class PropertyGraphLogicalDeleteTest : public ::testing::Test { CreateEdgeTypeParam BuildCreateEdgeTypeParam( const std::string& src_type, const std::string& dst_type, const std::string& edge_type, - const std::vector>& properties, + const std::vector>& properties, EdgeStrategy oe_strategy = EdgeStrategy::kMultiple, EdgeStrategy ie_strategy = EdgeStrategy::kMultiple) { CreateEdgeTypeParamBuilder builder; @@ -101,11 +101,11 @@ class PropertyGraphLogicalDeleteTest : public ::testing::Test { // Test DeleteVertexType - physically removes vertex type and data TEST_F(PropertyGraphLogicalDeleteTest, DeleteVertexType_RemovesTypeAndData) { // Create a vertex type with properties - std::vector> properties = { - {"age", execution::Value::INT32(0)}, - {"name", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"age", neug::Value::INT32(0)}, + {"name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; - properties.insert(properties.begin(), {"id", execution::Value::INT64(0L)}); + properties.insert(properties.begin(), {"id", neug::Value::INT64(0L)}); auto status = graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", properties, pk_names)); @@ -126,9 +126,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, DeleteVertexType_RemovesTypeAndData) { // Test corner case: Create -> Delete Physical -> Create again TEST_F(PropertyGraphLogicalDeleteTest, CreateDeletePhysicalRecreate_Succeeds) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; // First creation @@ -155,9 +155,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, CreateDeletePhysicalRecreate_Succeeds) { TEST_F(PropertyGraphLogicalDeleteTest, CreateDeleteLogicalRecreate_ActsAsRevert) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; auto status = graph_.CreateVertexType( @@ -179,8 +179,8 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test DeleteEdgeType TEST_F(PropertyGraphLogicalDeleteTest, DeleteEdgeTypePhysical_RemovesEdgeType) { // Create source and destination vertex types - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}}; std::vector pk_names = {"id"}; auto status = graph_.CreateVertexType( @@ -191,8 +191,8 @@ TEST_F(PropertyGraphLogicalDeleteTest, DeleteEdgeTypePhysical_RemovesEdgeType) { ASSERT_TRUE(status.ok()); // Create edge type - std::vector> e_props = { - {"years", execution::Value::INT32(0)}}; + std::vector> e_props = { + {"years", neug::Value::INT32(0)}}; status = graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props)); ASSERT_TRUE(status.ok()); @@ -212,10 +212,10 @@ TEST_F(PropertyGraphLogicalDeleteTest, DeleteEdgeTypePhysical_RemovesEdgeType) { // Test DeleteVertexProperties TEST_F(PropertyGraphLogicalDeleteTest, DeleteVertexPropertiesPhysical_RemovesProperties) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}, - {"age", execution::Value::INT32(0)}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}, + {"age", neug::Value::INT32(0)}}; std::vector pk_names = {"id"}; auto status = graph_.CreateVertexType( @@ -240,10 +240,10 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test DeleteVertexPropertiesSoft TEST_F(PropertyGraphLogicalDeleteTest, DeleteVertexPropertiesLogical_MarksPropertiesDeleted) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}, - {"age", execution::Value::INT32(0)}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}, + {"age", neug::Value::INT32(0)}}; std::vector pk_names = {"id"}; auto status = graph_.CreateVertexType( @@ -266,8 +266,8 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test DeleteEdgeProperties TEST_F(PropertyGraphLogicalDeleteTest, DeleteEdgePropertiesPhysical_RemovesProperties) { - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( @@ -275,9 +275,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, graph_.CreateVertexType( BuildCreateVertexTypeParam("Company", v_props, pk_names)); - std::vector> e_props = { - {"years", execution::Value::INT32(0)}, - {"position", execution::Value::STRING(std::string("string"))}}; + std::vector> e_props = { + {"years", neug::Value::INT32(0)}, + {"position", neug::Value::STRING(std::string("string"))}}; auto status = graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props)); ASSERT_TRUE(status.ok()); @@ -306,8 +306,8 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test DeleteEdgePropertiesSoft TEST_F(PropertyGraphLogicalDeleteTest, DeleteEdgePropertiesLogical_MarksPropertiesDeleted) { - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( @@ -315,9 +315,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, graph_.CreateVertexType( BuildCreateVertexTypeParam("Company", v_props, pk_names)); - std::vector> e_props = { - {"years", execution::Value::INT32(0)}, - {"position", execution::Value::STRING(std::string("string"))}}; + std::vector> e_props = { + {"years", neug::Value::INT32(0)}, + {"position", neug::Value::STRING(std::string("string"))}}; graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props)); @@ -338,11 +338,11 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test corner case: Multiple logical deletes TEST_F(PropertyGraphLogicalDeleteTest, MultipleLogicalDeletes_WorksCorrectly) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}, - {"age", execution::Value::INT32(0)}, - {"email", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}, + {"age", neug::Value::INT32(0)}, + {"email", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( @@ -362,9 +362,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, MultipleLogicalDeletes_WorksCorrectly) { // Test corner case: Cannot delete primary key property TEST_F(PropertyGraphLogicalDeleteTest, DeletePrimaryKeyProperty_ShouldFail) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( @@ -381,10 +381,10 @@ TEST_F(PropertyGraphLogicalDeleteTest, DeletePrimaryKeyProperty_ShouldFail) { // Test physical delete of properties after logical delete TEST_F(PropertyGraphLogicalDeleteTest, PhysicalDeletePropertiesAfterLogicalDelete_Succeeds) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}, - {"age", execution::Value::INT32(0)}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}, + {"age", neug::Value::INT32(0)}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", properties, pk_names)); @@ -404,16 +404,16 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test physical delete of edge properties after logical delete TEST_F(PropertyGraphLogicalDeleteTest, PhysicalDeleteEdgePropertiesAfterLogicalDelete_Succeeds) { - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", v_props, pk_names)); graph_.CreateVertexType( BuildCreateVertexTypeParam("Company", v_props, pk_names)); - std::vector> e_props = { - {"years", execution::Value::INT32(0)}, - {"position", execution::Value::STRING(std::string("string"))}}; + std::vector> e_props = { + {"years", neug::Value::INT32(0)}, + {"position", neug::Value::STRING(std::string("string"))}}; graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props)); label_t src_label = graph_.schema().get_vertex_label_id("Person"); @@ -437,9 +437,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, // contains the Delete label and properties. TEST_F(PropertyGraphLogicalDeleteTest, StatisticsAfterLogicalDelete_DoesNotContainDeletedInfo) { - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}, - {"Name", execution::Value::STRING(std::string("string"))}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}, + {"Name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", v_props, pk_names)); @@ -447,12 +447,12 @@ TEST_F(PropertyGraphLogicalDeleteTest, BuildCreateVertexTypeParam("Company", v_props, pk_names)); graph_.CreateVertexType( BuildCreateVertexTypeParam("Location", v_props, pk_names)); - std::vector> e_props_workat = { - {"years", execution::Value::INT32(0)}, - {"position", execution::Value::STRING(std::string("string"))}}; - std::vector> e_props_locatedat = { - {"since", execution::Value::INT32(0)}, - {"city", execution::Value::STRING(std::string("string"))}}; + std::vector> e_props_workat = { + {"years", neug::Value::INT32(0)}, + {"position", neug::Value::STRING(std::string("string"))}}; + std::vector> e_props_locatedat = { + {"since", neug::Value::INT32(0)}, + {"city", neug::Value::STRING(std::string("string"))}}; graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props_workat)); graph_.CreateEdgeType(BuildCreateEdgeTypeParam( @@ -492,9 +492,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, // Test deleting primary key: should raise an error TEST_F(PropertyGraphLogicalDeleteTest, DeletePrimaryKeyProperty_ShouldRaiseError) { - std::vector> properties = { - {"id", execution::Value::INT64(0L)}, - {"name", execution::Value::STRING(std::string("string"))}}; + std::vector> properties = { + {"id", neug::Value::INT64(0L)}, + {"name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; auto status = graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", properties, pk_names)); @@ -508,9 +508,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, TEST_F(PropertyGraphLogicalDeleteTest, TestStatistics) { // Insert vertex types and edge types to an empty schema, and check // whether the statistics are correct. - std::vector> v_props = { - {"id", execution::Value::INT64(0L)}, - {"Name", execution::Value::STRING(std::string("string"))}}; + std::vector> v_props = { + {"id", neug::Value::INT64(0L)}, + {"Name", neug::Value::STRING(std::string("string"))}}; std::vector pk_names = {"id"}; graph_.CreateVertexType( BuildCreateVertexTypeParam("Person", v_props, pk_names)); @@ -518,9 +518,9 @@ TEST_F(PropertyGraphLogicalDeleteTest, TestStatistics) { BuildCreateVertexTypeParam("Company", v_props, pk_names)); graph_.CreateVertexType( BuildCreateVertexTypeParam("Location", v_props, pk_names)); - std::vector> e_props = { - {"years", execution::Value::INT32(0)}, - {"position", execution::Value::STRING(std::string("string"))}}; + std::vector> e_props = { + {"years", neug::Value::INT32(0)}, + {"position", neug::Value::STRING(std::string("string"))}}; graph_.CreateEdgeType( BuildCreateEdgeTypeParam("Person", "Company", "WorksAt", e_props)); graph_.CreateEdgeType( diff --git a/tests/unittest/schema_test.cc b/tests/unittest/schema_test.cc index e6dc56082..c5a1faa59 100644 --- a/tests/unittest/schema_test.cc +++ b/tests/unittest/schema_test.cc @@ -23,7 +23,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/graph/schema.h" #include "neug/utils/property/types.h" @@ -80,7 +80,7 @@ TEST(SchemaTest, AddVertexLabel_AddRenameDeleteVertexProperties_Physical) { // 2) Add vertex properties std::vector add_names = {"age", "score"}; std::vector add_types = {DataTypeId::kInt32, DataTypeId::kDouble}; - std::vector add_defaults; // not used currently + std::vector add_defaults; // not used currently schema.AddVertexProperties("Person", add_names, add_types, add_defaults); ASSERT_EQ(schema.get_vertex_properties("Person").size(), 3); @@ -159,7 +159,7 @@ TEST(SchemaTest, AddEdgeLabel_AddRenameDeleteEdgeProperties_Physical) { std::vector add_e_names = {"role", "salary"}; std::vector add_e_types = {DataTypeId::kVarchar, DataTypeId::kInt64}; - std::vector dummy_defaults; + std::vector dummy_defaults; schema.AddEdgeProperties("Person", "Company", "WorksAt", add_e_names, add_e_types, dummy_defaults); auto names_after_add = diff --git a/tests/unittest/test_column.cc b/tests/unittest/test_column.cc index bfb984c7a..03b154da6 100644 --- a/tests/unittest/test_column.cc +++ b/tests/unittest/test_column.cc @@ -86,17 +86,17 @@ TEST(ArrayValueTest, ConstructorValidatesPayloadShapeInDebug) { auto array_type = DataType::Array(DataType::INT32, 2); auto build_invalid_array_wrong_size = [&array_type]() { - std::vector values; - values.emplace_back(execution::Value::INT32(1)); - auto value = execution::Value::ARRAY(array_type, std::move(values)); + std::vector values; + values.emplace_back(Value::INT32(1)); + auto value = Value::ARRAY(array_type, std::move(values)); (void) value; }; auto build_invalid_array_wrong_type = [&array_type]() { - std::vector values; - values.emplace_back(execution::Value::INT32(1)); - values.emplace_back(execution::Value::INT64(2)); - auto value = execution::Value::ARRAY(array_type, std::move(values)); + std::vector values; + values.emplace_back(Value::INT32(1)); + values.emplace_back(Value::INT64(2)); + auto value = Value::ARRAY(array_type, std::move(values)); (void) value; }; @@ -358,22 +358,18 @@ TEST(ArrayColumnTest, SetAnyRequiresArrayValue) { column.Open(*ckp, ModuleDescriptor(), MemoryLevel::kInMemory); column.resize(1); - std::vector list_values = {execution::Value::INT32(1), - execution::Value::INT32(2)}; - auto list_value = - execution::Value::LIST(DataType::INT32, std::move(list_values)); + std::vector list_values = {Value::INT32(1), Value::INT32(2)}; + auto list_value = Value::LIST(DataType::INT32, std::move(list_values)); EXPECT_THROW({ column.set_any(0, list_value, true); }, exception::InvalidArgumentException); - std::vector array_values = {execution::Value::INT32(3), - execution::Value::INT32(4)}; - auto array_value = - execution::Value::ARRAY(array_type, std::move(array_values)); + std::vector array_values = {Value::INT32(3), Value::INT32(4)}; + auto array_value = Value::ARRAY(array_type, std::move(array_values)); EXPECT_NO_THROW({ column.set_any(0, array_value, true); }); auto stored = column.get_any(0); ASSERT_EQ(stored.type(), array_type); - const auto& stored_values = execution::ArrayValue::GetChildren(stored); + const auto& stored_values = ArrayValue::GetChildren(stored); ASSERT_EQ(stored_values.size(), 2); EXPECT_EQ(stored_values[0].GetValue(), 3); EXPECT_EQ(stored_values[1].GetValue(), 4); diff --git a/tests/unittest/test_connection.cc b/tests/unittest/test_connection.cc index 418f4ecf9..01cf48e82 100644 --- a/tests/unittest/test_connection.cc +++ b/tests/unittest/test_connection.cc @@ -203,8 +203,8 @@ TEST_F(ConnectionTest, TestParameterizedQuery) { auto res = conn->Query( "MATCH (n:PERSON {id: $person_id}) SET n.id2 = n.id2 + $increment;", "update", - {{"person_id", execution::Value::INT64(1)}, - {"increment", execution::Value::INT64(5)}}); + {{"person_id", neug::Value::INT64(1)}, + {"increment", neug::Value::INT64(5)}}); EXPECT_TRUE(res); LOG(INFO) << res.value().ToString(); } diff --git a/tests/unittest/test_indexer.cc b/tests/unittest/test_indexer.cc index dd38aa9ff..8cde30edc 100644 --- a/tests/unittest/test_indexer.cc +++ b/tests/unittest/test_indexer.cc @@ -24,7 +24,7 @@ #include #include "neug/common/extra_type_info.h" -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/container/file_header.h" #include "neug/storages/module/module_factory.h" @@ -62,7 +62,7 @@ class LFIndexerTest : public ::testing::Test { ASSERT_EQ(indexer.size(), values.size()); for (size_t i = 0; i < values.size(); ++i) { INDEX_T lid; - ASSERT_TRUE(indexer.get_index(execution::Value::INT64(values[i]), lid)); + ASSERT_TRUE(indexer.get_index(neug::Value::INT64(values[i]), lid)); EXPECT_EQ(lid, static_cast(i)); const auto& key = indexer.get_key(static_cast(i)); @@ -79,7 +79,7 @@ class LFIndexerTest : public ::testing::Test { ASSERT_EQ(indexer.size(), values.size()); for (size_t i = 0; i < values.size(); ++i) { INDEX_T lid; - ASSERT_TRUE(indexer.get_index(execution::Value::STRING(values[i]), lid)); + ASSERT_TRUE(indexer.get_index(neug::Value::STRING(values[i]), lid)); EXPECT_EQ(lid, static_cast(i)); const auto& key = indexer.get_key(static_cast(i)); @@ -109,9 +109,9 @@ TEST_F(LFIndexerTest, SupportsCoreMutableInterfacesInMemory) { EXPECT_GE(indexer.capacity(), 8U); std::vector values = {7, 11, 13, 17, 19, 23, 29, 31, 37, 41}; - EXPECT_EQ(indexer.insert(execution::Value::INT64(values[0]), false), 0U); + EXPECT_EQ(indexer.insert(neug::Value::INT64(values[0]), false), 0U); for (size_t i = 1; i < values.size(); ++i) { - EXPECT_EQ(indexer.insert(execution::Value::INT64(values[i]), true), + EXPECT_EQ(indexer.insert(neug::Value::INT64(values[i]), true), static_cast(i)); } @@ -120,12 +120,12 @@ TEST_F(LFIndexerTest, SupportsCoreMutableInterfacesInMemory) { ExpectInt64Values(indexer, values); uint32_t lid = std::numeric_limits::max(); - EXPECT_TRUE(indexer.get_index(execution::Value::INT64(23), lid)); + EXPECT_TRUE(indexer.get_index(neug::Value::INT64(23), lid)); EXPECT_EQ(lid, 5U); - EXPECT_FALSE(indexer.get_index(execution::Value::INT32(23), lid)); - EXPECT_TRUE(indexer.contains(execution::Value::INT64(37))); - EXPECT_FALSE(indexer.contains(execution::Value::INT64(1001))); - EXPECT_EQ(indexer.get_index(execution::Value::INT64(1001)), + EXPECT_FALSE(indexer.get_index(neug::Value::INT32(23), lid)); + EXPECT_TRUE(indexer.contains(neug::Value::INT64(37))); + EXPECT_FALSE(indexer.contains(neug::Value::INT64(1001))); + EXPECT_EQ(indexer.get_index(neug::Value::INT64(1001)), std::numeric_limits::max()); indexer.rehash(64); @@ -148,7 +148,7 @@ TEST_F(LFIndexerTest, DumpsAndOpensAcrossBackends) { OpenIndexerLegacy(writable, *ckp, int64_type, CheckpointManifest(), MemoryLevel::kInMemory); for (const auto& value : values) { - writable.insert(execution::Value::INT64(value), true); + writable.insert(neug::Value::INT64(value), true); } desc = DumpIndexerLegacy(writable, *ckp); } @@ -208,10 +208,10 @@ TEST_F(LFIndexerTest, SupportsBuildEmptySwapAndVarcharKeys) { std::vector lhs_values = {"alice", "bob"}; std::vector rhs_values = {"carol", "dave", "erin"}; for (const auto& value : lhs_values) { - lhs.insert(execution::Value::STRING(value), true); + lhs.insert(neug::Value::STRING(value), true); } for (const auto& value : rhs_values) { - rhs.insert(execution::Value::STRING(value), true); + rhs.insert(neug::Value::STRING(value), true); } EXPECT_EQ(lhs.get_type(), DataTypeId::kVarchar); @@ -245,7 +245,7 @@ TEST_F(LFIndexerTest, VarcharReserveEnablesNonSafeInsert) { std::vector values = {"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta"}; for (const auto& v : values) { - indexer.insert(execution::Value::STRING(v), false); + indexer.insert(neug::Value::STRING(v), false); } ExpectStringValues(indexer, values); indexer.Close(); @@ -272,7 +272,7 @@ TEST_F(LFIndexerTest, VarcharReserveMaxWidthStrings) { values.push_back(std::string(kMaxWidth - 1, static_cast('a' + i))); } for (const auto& v : values) { - indexer.insert(execution::Value::STRING(v), false); + indexer.insert(neug::Value::STRING(v), false); } ExpectStringValues(indexer, values); indexer.Close(); @@ -292,14 +292,14 @@ TEST_F(LFIndexerTest, VarcharMultipleReservesAccumulateDataSpace) { indexer.reserve(4); std::vector batch1 = {"alice", "bob", "carol", "dave"}; for (const auto& v : batch1) { - indexer.insert(execution::Value::STRING(v), false); + indexer.insert(neug::Value::STRING(v), false); } ExpectStringValues(indexer, batch1); indexer.reserve(8); std::vector batch2 = {"erin", "frank", "grace", "heidi"}; for (const auto& v : batch2) { - indexer.insert(execution::Value::STRING(v), false); + indexer.insert(neug::Value::STRING(v), false); } std::vector all = {"alice", "bob", "carol", "dave", @@ -322,10 +322,10 @@ TEST_F(LFIndexerTest, VarcharReserveSmallerThanCapacityIsNoop) { indexer.reserve(16); EXPECT_GE(indexer.capacity(), 16U); size_t size_before = indexer.size(); - indexer.insert(execution::Value::STRING(std::string("foo")), false); - indexer.insert(execution::Value::STRING(std::string("bar")), false); - indexer.insert(execution::Value::STRING(std::string("baz")), false); - indexer.insert(execution::Value::STRING(std::string("qux")), false); + indexer.insert(neug::Value::STRING(std::string("foo")), false); + indexer.insert(neug::Value::STRING(std::string("bar")), false); + indexer.insert(neug::Value::STRING(std::string("baz")), false); + indexer.insert(neug::Value::STRING(std::string("qux")), false); indexer.reserve(4); EXPECT_GE(indexer.capacity(), size_before); @@ -346,7 +346,7 @@ TEST_F(LFIndexerTest, VarcharRehashPreservesData) { std::vector values = {"foo", "bar", "baz", "qux", "quux", "corge", "grault"}; for (const auto& v : values) { - indexer.insert(execution::Value::STRING(v), true); + indexer.insert(neug::Value::STRING(v), true); } ExpectStringValues(indexer, values); @@ -373,7 +373,7 @@ TEST_F(LFIndexerTest, VarcharReserveInsertDumpReload) { std::vector values = {"one", "two", "three", "four", "five"}; for (const auto& v : values) { - writable.insert(execution::Value::STRING(v), false); + writable.insert(neug::Value::STRING(v), false); } ExpectStringValues(writable, values); @@ -402,7 +402,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenReserveThenInsertLong_InMemory) { OpenIndexerLegacy(writer, *ckp, string_type, CheckpointManifest(), MemoryLevel::kInMemory); for (const auto& v : short_values) { - writer.insert(execution::Value::STRING(v), true); + writer.insert(neug::Value::STRING(v), true); } dump_desc = DumpIndexerLegacy(writer, *ckp); } @@ -421,7 +421,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenReserveThenInsertLong_InMemory) { long_values.push_back(std::string(60, static_cast('d' + i))); } for (const auto& v : long_values) { - indexer.insert(execution::Value::STRING(v), true); + indexer.insert(neug::Value::STRING(v), true); } std::vector all = short_values; @@ -447,7 +447,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenInsertSafeLong_InMemory) { MemoryLevel::kInMemory); writer.reserve(short_values.size()); for (const auto& v : short_values) { - writer.insert(execution::Value::STRING(v), false); + writer.insert(neug::Value::STRING(v), false); } dump_desc = DumpIndexerLegacy(writer, *ckp); writer.Close(); @@ -463,7 +463,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenInsertSafeLong_InMemory) { long_values.push_back(std::string(45, static_cast('A' + i))); } for (const auto& v : long_values) { - indexer.insert(execution::Value::STRING(v), true); + indexer.insert(neug::Value::STRING(v), true); } std::vector all = short_values; @@ -488,7 +488,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenReserveThenInsertLong_SyncToFile) { OpenIndexerLegacy(writer, *ckp, string_type, CheckpointManifest(), MemoryLevel::kInMemory); for (const auto& v : short_values) { - writer.insert(execution::Value::STRING(v), true); + writer.insert(neug::Value::STRING(v), true); } dump_desc = DumpIndexerLegacy(writer, *ckp); writer.Close(); @@ -508,7 +508,7 @@ TEST_F(LFIndexerTest, VarcharShortDumpReopenReserveThenInsertLong_SyncToFile) { long_values.push_back(std::string(30, static_cast('p' + i))); } for (const auto& v : long_values) { - indexer.insert(execution::Value::STRING(v), true); + indexer.insert(neug::Value::STRING(v), true); } std::vector all = short_values; @@ -537,7 +537,7 @@ TEST_F(LFIndexerTest, VarcharStringOverflow) { }; for (const auto& v : valid_strings) { - indexer.insert(execution::Value::STRING(v), false); + indexer.insert(neug::Value::STRING(v), false); } ExpectStringValues(indexer, valid_strings); indexer.reserve(8); @@ -546,12 +546,12 @@ TEST_F(LFIndexerTest, VarcharStringOverflow) { for (size_t i = 0; i < 2; ++i) { std::string test_string = overflow_string + std::to_string(i); // 31 chars + 1 char = 32 chars - indexer.insert(execution::Value::STRING(test_string), false); + indexer.insert(neug::Value::STRING(test_string), false); valid_strings.push_back(test_string); } ExpectStringValues(indexer, valid_strings); - EXPECT_THROW(indexer.insert(execution::Value::STRING(overflow_string), false), + EXPECT_THROW(indexer.insert(neug::Value::STRING(overflow_string), false), neug::exception::StorageException); indexer.Close(); diff --git a/tests/unittest/utils.h b/tests/unittest/utils.h index 0d9a6ed6b..e0f023390 100644 --- a/tests/unittest/utils.h +++ b/tests/unittest/utils.h @@ -24,8 +24,8 @@ #include #include -#include "neug/execution/common/columns/value_columns.h" -#include "neug/execution/common/data_chunk.h" +#include "neug/common/columns/value_columns.h" +#include "neug/common/types/data_chunk.h" #include "neug/main/connection.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/checkpoint_manifest.h" @@ -43,11 +43,11 @@ class GeneratedChunkSupplier : public neug::IDataChunkSupplier { public: explicit GeneratedChunkSupplier( - std::vector>&& chunks) + std::vector>&& chunks) : chunks_(std::move(chunks)) {} ~GeneratedChunkSupplier() override = default; - std::shared_ptr GetNextChunk() override { + std::shared_ptr GetNextChunk() override { if (chunks_.empty()) { return nullptr; } @@ -67,24 +67,24 @@ class GeneratedChunkSupplier : public neug::IDataChunkSupplier { } private: - std::vector> chunks_; + std::vector> chunks_; }; template -std::shared_ptr build_value_column_slice( +std::shared_ptr build_value_column_slice( const std::vector& data, size_t begin, size_t end) { - neug::execution::ValueColumnBuilder builder; + neug::ValueColumnBuilder builder; for (size_t i = begin; i < end && i < data.size(); ++i) { - builder.push_back_elem(neug::execution::Value::CreateValue(data[i])); + builder.push_back_elem(neug::Value::CreateValue(data[i])); } return builder.finish(); } template -std::vector> -split_column_to_chunks(const std::vector& data, int num_chunks) { +std::vector> split_column_to_chunks( + const std::vector& data, int num_chunks) { size_t chunk_size = (data.size() + num_chunks - 1) / num_chunks; - std::vector> columns; + std::vector> columns; for (int i = 0; i < num_chunks; ++i) { size_t begin = i * chunk_size; size_t end = std::min(begin + chunk_size, data.size()); @@ -96,10 +96,8 @@ split_column_to_chunks(const std::vector& data, int num_chunks) { return columns; } -inline std::vector> -convert_to_data_chunks( - const std::vector< - std::vector>>& +inline std::vector> convert_to_data_chunks( + const std::vector>>& column_chunks) { if (column_chunks.empty()) { return {}; @@ -118,14 +116,13 @@ convert_to_data_chunks( } } } - std::vector> chunks; + std::vector> chunks; for (size_t i = 0; i < chunk_sizes.size(); ++i) { - neug::execution::DataChunk chunk; + neug::DataChunk chunk; for (size_t col = 0; col < column_chunks.size(); ++col) { chunk.set(static_cast(col), column_chunks[col][i]); } - chunks.push_back( - std::make_shared(std::move(chunk))); + chunks.push_back(std::make_shared(std::move(chunk))); } return chunks; } diff --git a/tests/utils/json_test.cc b/tests/utils/json_test.cc index 624130fef..46b8fd395 100644 --- a/tests/utils/json_test.cc +++ b/tests/utils/json_test.cc @@ -20,8 +20,8 @@ #include #include +#include "neug/common/columns/value_columns.h" #include "neug/compiler/common/case_insensitive_map.h" -#include "neug/execution/common/columns/value_columns.h" #include "neug/execution/common/context.h" #include "neug/generated/proto/plan/basic_type.pb.h" #include "neug/utils/io/read/common/options.h" @@ -130,12 +130,12 @@ TEST_F(JsonTest, TestJsonArray) { EXPECT_EQ(ctx.row_num(), 2); auto col0 = ctx.chunk(0).columns()[0]; - ASSERT_EQ(col0->column_type(), execution::ContextColumnType::kValue); + ASSERT_EQ(col0->column_type(), ContextColumnType::kValue); EXPECT_EQ(col0->get_elem(0).GetValue(), 1u); EXPECT_EQ(col0->get_elem(1).GetValue(), 2u); auto col2 = ctx.chunk(0).columns()[2]; - ASSERT_EQ(col2->column_type(), execution::ContextColumnType::kValue); + ASSERT_EQ(col2->column_type(), ContextColumnType::kValue); EXPECT_DOUBLE_EQ(col2->get_elem(0).GetValue(), 25.0); EXPECT_DOUBLE_EQ(col2->get_elem(1).GetValue(), 30.0); } diff --git a/tests/utils/test_reader.cc b/tests/utils/test_reader.cc index 2d3e2c072..90a4db953 100644 --- a/tests/utils/test_reader.cc +++ b/tests/utils/test_reader.cc @@ -292,12 +292,12 @@ TEST_F(ReaderTest, TestForceColumnTypeConversion) { // Verify the first column (id) is int32 ValueColumn auto column0 = ctx.chunk(0).columns()[0]; - ASSERT_EQ(column0->column_type(), execution::ContextColumnType::kValue); + ASSERT_EQ(column0->column_type(), ContextColumnType::kValue); EXPECT_EQ(column0->elem_type().id(), DataTypeId::kInt32); // Verify the third column (value) is int64 ValueColumn auto column2 = ctx.chunk(0).columns()[2]; - ASSERT_EQ(column2->column_type(), execution::ContextColumnType::kValue); + ASSERT_EQ(column2->column_type(), ContextColumnType::kValue); EXPECT_EQ(column2->elem_type().id(), DataTypeId::kInt64); } diff --git a/tests/utils/test_reader.h b/tests/utils/test_reader.h index 7f0142337..0ef410c37 100644 --- a/tests/utils/test_reader.h +++ b/tests/utils/test_reader.h @@ -26,9 +26,9 @@ #include #include +#include "neug/common/types/data_chunk.h" #include "neug/compiler/common/case_insensitive_map.h" #include "neug/execution/common/context.h" -#include "neug/execution/common/data_chunk.h" #include "neug/generated/proto/plan/basic_type.pb.h" #include "neug/generated/proto/plan/expr.pb.h" #include "neug/utils/io/read/common/options.h" diff --git a/tests/utils/test_table.cc b/tests/utils/test_table.cc index 2ec8a3c80..8a82f8f5e 100644 --- a/tests/utils/test_table.cc +++ b/tests/utils/test_table.cc @@ -16,7 +16,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/storages/checkpoint_manager.h" #include "neug/storages/checkpoint_manifest.h" #include "neug/storages/module/module_broker.h" @@ -197,61 +197,59 @@ TEST_F(TableTest, TestTableBasic) { size_t index = 0; for (size_t i = 0; i < 10; i++) { disk_table.get_column("bool_column") - ->set_any(index, execution::Value::BOOLEAN(bool_data[i]), false); + ->set_any(index, neug::Value::BOOLEAN(bool_data[i]), false); mem_table.get_column("bool_column") - ->set_any(index, execution::Value::BOOLEAN(bool_data[i]), false); + ->set_any(index, neug::Value::BOOLEAN(bool_data[i]), false); disk_table.get_column("int32_column") - ->set_any(index, execution::Value::INT32(int32_data[i]), false); + ->set_any(index, neug::Value::INT32(int32_data[i]), false); mem_table.get_column("int32_column") - ->set_any(index, execution::Value::INT32(int32_data[i]), false); + ->set_any(index, neug::Value::INT32(int32_data[i]), false); disk_table.get_column("uint32_column") - ->set_any(index, execution::Value::UINT32(uint32_data[i]), false); + ->set_any(index, neug::Value::UINT32(uint32_data[i]), false); mem_table.get_column("uint32_column") - ->set_any(index, execution::Value::UINT32(uint32_data[i]), false); + ->set_any(index, neug::Value::UINT32(uint32_data[i]), false); disk_table.get_column("int64_column") - ->set_any(index, execution::Value::INT64(int64_data[i]), false); + ->set_any(index, neug::Value::INT64(int64_data[i]), false); mem_table.get_column("int64_column") - ->set_any(index, execution::Value::INT64(int64_data[i]), false); + ->set_any(index, neug::Value::INT64(int64_data[i]), false); disk_table.get_column("uint64_column") - ->set_any(index, execution::Value::UINT64(uint64_data[i]), false); + ->set_any(index, neug::Value::UINT64(uint64_data[i]), false); mem_table.get_column("uint64_column") - ->set_any(index, execution::Value::UINT64(uint64_data[i]), false); + ->set_any(index, neug::Value::UINT64(uint64_data[i]), false); disk_table.get_column("float_column") - ->set_any(index, execution::Value::FLOAT(float_data[i]), false); + ->set_any(index, neug::Value::FLOAT(float_data[i]), false); mem_table.get_column("float_column") - ->set_any(index, execution::Value::FLOAT(float_data[i]), false); + ->set_any(index, neug::Value::FLOAT(float_data[i]), false); disk_table.get_column("double_column") - ->set_any(index, execution::Value::DOUBLE(double_data[i]), false); + ->set_any(index, neug::Value::DOUBLE(double_data[i]), false); mem_table.get_column("double_column") - ->set_any(index, execution::Value::DOUBLE(double_data[i]), false); + ->set_any(index, neug::Value::DOUBLE(double_data[i]), false); disk_table.get_column("date_column") - ->set_any(index, execution::Value::DATE(date_data[i]), false); + ->set_any(index, neug::Value::DATE(date_data[i]), false); mem_table.get_column("date_column") - ->set_any(index, execution::Value::DATE(date_data[i]), false); + ->set_any(index, neug::Value::DATE(date_data[i]), false); disk_table.get_column("datetime_column") - ->set_any(index, execution::Value::TIMESTAMPMS(datetime_data[i]), - false); + ->set_any(index, neug::Value::TIMESTAMPMS(datetime_data[i]), false); mem_table.get_column("datetime_column") - ->set_any(index, execution::Value::TIMESTAMPMS(datetime_data[i]), - false); + ->set_any(index, neug::Value::TIMESTAMPMS(datetime_data[i]), false); disk_table.get_column("interval_column") - ->set_any(index, execution::Value::INTERVAL(interval_data[i]), false); + ->set_any(index, neug::Value::INTERVAL(interval_data[i]), false); mem_table.get_column("interval_column") - ->set_any(index, execution::Value::INTERVAL(interval_data[i]), false); + ->set_any(index, neug::Value::INTERVAL(interval_data[i]), false); disk_table.get_column("string_column") - ->set_any(index, execution::Value::STRING(string_data[i]), true); + ->set_any(index, neug::Value::STRING(string_data[i]), true); mem_table.get_column("string_column") - ->set_any(index, execution::Value::STRING(string_data[i]), true); + ->set_any(index, neug::Value::STRING(string_data[i]), true); index++; } @@ -434,8 +432,8 @@ TEST_F(TableTest, StringColumnDistinguishesUnsetFromEmptyString) { Table table(col_name, property_types); OpenTableLegacy(table, *ckp, CheckpointManifest(), MemoryLevel::kInMemory, property_types); - table.resize(2, std::vector{ - execution::Value::STRING(std::string("default_value"))}); + table.resize(2, std::vector{ + neug::Value::STRING(std::string("default_value"))}); auto string_column = dynamic_cast(table.get_column("string_column")); @@ -443,11 +441,11 @@ TEST_F(TableTest, StringColumnDistinguishesUnsetFromEmptyString) { EXPECT_EQ(string_column->get_any(0).GetValue(), "default_value"); - string_column->set_any(1, execution::Value::STRING(std::string("")), true); + string_column->set_any(1, neug::Value::STRING(std::string("")), true); EXPECT_TRUE(string_column->get_any(1).GetValue().empty()); EXPECT_EQ(string_column->get_any(1).type().id(), DataTypeId::kVarchar); string_column->set_any( - 1, execution::Value::STRING(std::string("new value new value new value")), + 1, neug::Value::STRING(std::string("new value new value new value")), true); EXPECT_EQ(string_column->get_any(1).GetValue(), "new value new value new value"); diff --git a/tests/utils/test_types.cc b/tests/utils/test_types.cc index 6cfb2d88c..4b0b1f4c0 100644 --- a/tests/utils/test_types.cc +++ b/tests/utils/test_types.cc @@ -15,7 +15,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/property/column.h" #include "neug/utils/property/table.h" #include "neug/utils/serialization/in_archive.h" @@ -249,37 +249,37 @@ class ValueTest : public ::testing::Test { }; TEST_F(ValueTest, DefaultConstructor) { - execution::Value v; + neug::Value v; EXPECT_TRUE(v.IsNull()); } TEST_F(ValueTest, BoolValue) { - auto v1 = execution::Value::BOOLEAN(true); + auto v1 = neug::Value::BOOLEAN(true); EXPECT_EQ(v1.type().id(), DataTypeId::kBoolean); EXPECT_TRUE(v1.GetValue()); - auto v2 = execution::Value::BOOLEAN(false); + auto v2 = neug::Value::BOOLEAN(false); EXPECT_FALSE(v2.GetValue()); } TEST_F(ValueTest, IntegerValues) { { - auto v = execution::Value::INT32(42); + auto v = neug::Value::INT32(42); EXPECT_EQ(v.type().id(), DataTypeId::kInt32); EXPECT_EQ(v.GetValue(), 42); } { - auto v = execution::Value::UINT32(100U); + auto v = neug::Value::UINT32(100U); EXPECT_EQ(v.type().id(), DataTypeId::kUInt32); EXPECT_EQ(v.GetValue(), 100U); } { - auto v = execution::Value::INT64(-1234567890123LL); + auto v = neug::Value::INT64(-1234567890123LL); EXPECT_EQ(v.type().id(), DataTypeId::kInt64); EXPECT_EQ(v.GetValue(), -1234567890123LL); } { - auto v = execution::Value::UINT64(9876543210ULL); + auto v = neug::Value::UINT64(9876543210ULL); EXPECT_EQ(v.type().id(), DataTypeId::kUInt64); EXPECT_EQ(v.GetValue(), 9876543210ULL); } @@ -287,12 +287,12 @@ TEST_F(ValueTest, IntegerValues) { TEST_F(ValueTest, FloatValues) { { - auto v = execution::Value::FLOAT(3.14f); + auto v = neug::Value::FLOAT(3.14f); EXPECT_EQ(v.type().id(), DataTypeId::kFloat); EXPECT_FLOAT_EQ(v.GetValue(), 3.14f); } { - auto v = execution::Value::DOUBLE(2.718281828); + auto v = neug::Value::DOUBLE(2.718281828); EXPECT_EQ(v.type().id(), DataTypeId::kDouble); EXPECT_DOUBLE_EQ(v.GetValue(), 2.718281828); } @@ -300,14 +300,14 @@ TEST_F(ValueTest, FloatValues) { TEST_F(ValueTest, StringValue) { std::string str = "hello world"; - auto v = execution::Value::STRING(str); + auto v = neug::Value::STRING(str); EXPECT_EQ(v.type().id(), DataTypeId::kVarchar); EXPECT_EQ(v.GetValue(), str); } TEST_F(ValueTest, TemplateConstructor) { - auto v1 = execution::Value::INT32(100); - auto v2 = execution::Value::INT32(100); + auto v1 = neug::Value::INT32(100); + auto v2 = neug::Value::INT32(100); EXPECT_EQ(v1.type().id(), v2.type().id()); EXPECT_EQ(v1.GetValue(), v2.GetValue()); @@ -315,18 +315,18 @@ TEST_F(ValueTest, TemplateConstructor) { TEST_F(ValueTest, GetStringValueUnified) { { - auto v = execution::Value::STRING(std::string("hello")); + auto v = neug::Value::STRING(std::string("hello")); EXPECT_EQ(v.GetValue(), "hello"); } { - auto v = execution::Value::STRING(std::string("world")); + auto v = neug::Value::STRING(std::string("world")); EXPECT_EQ(v.GetValue(), "world"); } } TEST_F(ValueTest, LessThan) { - auto v1 = execution::Value::INT32(10); - auto v2 = execution::Value::INT32(20); + auto v1 = neug::Value::INT32(10); + auto v2 = neug::Value::INT32(20); EXPECT_TRUE(v1 < v2); EXPECT_FALSE(v2 < v1); } @@ -334,17 +334,17 @@ TEST_F(ValueTest, LessThan) { TEST_F(ValueTest, DateAndTimeValues) { Date d; d.from_u32(33189664); - auto v_date = execution::Value::DATE(d); + auto v_date = neug::Value::DATE(d); EXPECT_EQ(v_date.type().id(), DataTypeId::kDate); EXPECT_EQ(v_date.GetValue().to_u32(), 33189664U); - auto v_dt = execution::Value::TIMESTAMPMS(DateTime(int64_t{1763365457000})); + auto v_dt = neug::Value::TIMESTAMPMS(DateTime(int64_t{1763365457000})); EXPECT_EQ(v_dt.type().id(), DataTypeId::kTimestampMs); EXPECT_EQ(v_dt.GetValue().to_string(), "2025-11-17 07:44:17.000"); Interval iv( std::string("4years3months2days20hours3minutes12seconds200milliseconds")); - auto v_iv = execution::Value::INTERVAL(iv); + auto v_iv = neug::Value::INTERVAL(iv); EXPECT_EQ(v_iv.type().id(), DataTypeId::kInterval); EXPECT_EQ( v_iv.GetValue().to_string(), @@ -352,19 +352,19 @@ TEST_F(ValueTest, DateAndTimeValues) { } TEST_F(ValueTest, AssignmentOperator) { - auto v1 = execution::Value::INT32(42); + auto v1 = neug::Value::INT32(42); auto v2 = v1; EXPECT_TRUE(v1 == v2); } TEST_F(ValueTest, EqualityOperator) { - auto v1 = execution::Value::INT32(42); - auto v2 = execution::Value::INT32(42); - auto v3 = execution::Value::INT32(43); - auto v4 = execution::Value::STRING(std::string("same")); - auto v5 = execution::Value::STRING(std::string("same")); - auto v6 = execution::Value::STRING(std::string("diff")); + auto v1 = neug::Value::INT32(42); + auto v2 = neug::Value::INT32(42); + auto v3 = neug::Value::INT32(43); + auto v4 = neug::Value::STRING(std::string("same")); + auto v5 = neug::Value::STRING(std::string("same")); + auto v6 = neug::Value::STRING(std::string("diff")); EXPECT_TRUE(v1 == v2); EXPECT_FALSE(v1 == v3); diff --git a/tests/utils/test_utils.cc b/tests/utils/test_utils.cc index 5c0419eab..cb6f56a32 100644 --- a/tests/utils/test_utils.cc +++ b/tests/utils/test_utils.cc @@ -18,7 +18,7 @@ #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/utils/bitset.h" #include "neug/utils/datetime_parsers.h" #include "neug/utils/encoder.h" @@ -1060,7 +1060,7 @@ TEST_F(PBUtilsTest, PropertyDefsToTuple_ArrayDefaultExpression) { ASSERT_EQ(result.value().size(), 1U); const auto& value = result.value()[0].second; EXPECT_EQ(value.type().id(), DataTypeId::kArray); - const auto& children = execution::ArrayValue::GetChildren(value); + const auto& children = ArrayValue::GetChildren(value); ASSERT_EQ(children.size(), 2U); EXPECT_EQ(children[0].GetValue(), 1); EXPECT_EQ(children[1].GetValue(), 2); @@ -1095,11 +1095,10 @@ TEST_F(PBUtilsTest, PropertyDefsToTuple_NestedArrayDefaultExpression) { auto result = property_defs_to_value(props); ASSERT_TRUE(result.has_value()); - const auto& rows = - execution::ArrayValue::GetChildren(result.value()[0].second); + const auto& rows = ArrayValue::GetChildren(result.value()[0].second); ASSERT_EQ(rows.size(), 2U); - const auto& first_row = execution::ArrayValue::GetChildren(rows[0]); - const auto& second_row = execution::ArrayValue::GetChildren(rows[1]); + const auto& first_row = ArrayValue::GetChildren(rows[0]); + const auto& second_row = ArrayValue::GetChildren(rows[1]); ASSERT_EQ(first_row.size(), 2U); ASSERT_EQ(second_row.size(), 2U); EXPECT_EQ(first_row[0].GetValue(), 1); diff --git a/tools/nodejs_bind/src/node_connection.h b/tools/nodejs_bind/src/node_connection.h index 1618f2adb..66577fe36 100644 --- a/tools/nodejs_bind/src/node_connection.h +++ b/tools/nodejs_bind/src/node_connection.h @@ -21,7 +21,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/connection.h" #include "neug/main/neug_db.h" #include "node_query_result.h" diff --git a/tools/nodejs_bind/src/node_query_request.cc b/tools/nodejs_bind/src/node_query_request.cc index b21cedfac..8bf14a74f 100644 --- a/tools/nodejs_bind/src/node_query_request.cc +++ b/tools/nodejs_bind/src/node_query_request.cc @@ -18,7 +18,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/query_request.h" #include "neug/utils/access_mode.h" #include "neug/utils/exception/exception.h" diff --git a/tools/python_bind/src/py_connection.h b/tools/python_bind/src/py_connection.h index 47856656b..5cb0ef120 100644 --- a/tools/python_bind/src/py_connection.h +++ b/tools/python_bind/src/py_connection.h @@ -19,7 +19,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/connection.h" #include "neug/main/neug_db.h" #include "py_query_result.h" diff --git a/tools/python_bind/src/py_query_request.cc b/tools/python_bind/src/py_query_request.cc index a4f3413f8..042a38234 100644 --- a/tools/python_bind/src/py_query_request.cc +++ b/tools/python_bind/src/py_query_request.cc @@ -17,7 +17,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "neug/main/query_request.h" #include "neug/utils/access_mode.h" #include "neug/utils/exception/exception.h" diff --git a/tools/python_bind/src/py_query_request.h b/tools/python_bind/src/py_query_request.h index 95c385d7f..208faffa4 100644 --- a/tools/python_bind/src/py_query_request.h +++ b/tools/python_bind/src/py_query_request.h @@ -17,7 +17,7 @@ #include #include -#include "neug/execution/common/types/value.h" +#include "neug/common/types/value.h" #include "pybind11/include/pybind11/pybind11.h" namespace neug {