diff --git a/src/core/functions/scalar/local_clustering_coefficient.cpp b/src/core/functions/scalar/local_clustering_coefficient.cpp index c4eae9e..8ded287 100644 --- a/src/core/functions/scalar/local_clustering_coefficient.cpp +++ b/src/core/functions/scalar/local_clustering_coefficient.cpp @@ -62,7 +62,8 @@ static void LocalClusteringCoefficientFunction(DataChunk &args, int64_t count = 0; for (int64_t offset = v[src_node]; offset < v[src_node + 1]; offset++) { int64_t neighbor = e[offset]; - for (int64_t offset2 = v[neighbor]; offset2 < v[neighbor + 1]; offset2++) { + for (int64_t offset2 = v[neighbor]; offset2 < v[neighbor + 1]; + offset2++) { int is_connected = neighbors.test(e[offset2]); count += is_connected; // Add 1 if connected, 0 otherwise } diff --git a/src/core/functions/table/describe_property_graph.cpp b/src/core/functions/table/describe_property_graph.cpp index 560921a..64b406f 100644 --- a/src/core/functions/table/describe_property_graph.cpp +++ b/src/core/functions/table/describe_property_graph.cpp @@ -162,7 +162,8 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( output.SetValue(12, vector_idx, Value()); } else { output.SetValue(12, vector_idx, Value(edge_table->catalog_name)); - } output.SetValue(13, vector_idx, Value(edge_table->schema_name)); + } + output.SetValue(13, vector_idx, Value(edge_table->schema_name)); vector_idx++; } output.SetCardinality(vector_idx); diff --git a/src/core/pragma/show_property_graphs.cpp b/src/core/pragma/show_property_graphs.cpp index e64937c..0cc9731 100644 --- a/src/core/pragma/show_property_graphs.cpp +++ b/src/core/pragma/show_property_graphs.cpp @@ -6,16 +6,17 @@ namespace duckpgq { namespace core { -static string PragmaShowPropertyGraphs(ClientContext &context, const FunctionParameters ¶meters) { +static string PragmaShowPropertyGraphs(ClientContext &context, + const FunctionParameters ¶meters) { return "SELECT DISTINCT property_graph from __duckpgq_internal"; } void CorePGQPragma::RegisterShowPropertyGraphs(DatabaseInstance &instance) { // Define the pragma function auto pragma_func = PragmaFunction::PragmaCall( - "show_property_graphs", // Name of the pragma - PragmaShowPropertyGraphs, // Query substitution function - {} // Parameter types (mail_limit is an integer) + "show_property_graphs", // Name of the pragma + PragmaShowPropertyGraphs, // Query substitution function + {} // Parameter types (mail_limit is an integer) ); // Register the pragma function diff --git a/src/duckpgq_state.cpp b/src/duckpgq_state.cpp index 4c5bde7..77abb8c 100644 --- a/src/duckpgq_state.cpp +++ b/src/duckpgq_state.cpp @@ -107,6 +107,7 @@ void DuckPGQState::PopulateEdgeSpecificFields(unique_ptr &chunk, void DuckPGQState::ExtractListValues(const Value &list_value, vector &output) { auto children = ListValue::GetChildren(list_value); + output.reserve(output.size() + children.size()); for (const auto &child : children) { output.push_back(child.GetValue()); } diff --git a/src/include/duckpgq/core/pragma/duckpgq_pragma.hpp b/src/include/duckpgq/core/pragma/duckpgq_pragma.hpp index 3f5d55e..d7fc0a7 100644 --- a/src/include/duckpgq/core/pragma/duckpgq_pragma.hpp +++ b/src/include/duckpgq/core/pragma/duckpgq_pragma.hpp @@ -22,11 +22,8 @@ class CorePGQPragma { private: static void RegisterShowPropertyGraphs(DatabaseInstance &instance); - }; - - } // namespace core } // namespace duckpgq \ No newline at end of file diff --git a/src/include/duckpgq_state.hpp b/src/include/duckpgq_state.hpp index c1e6538..1a5cd61 100644 --- a/src/include/duckpgq_state.hpp +++ b/src/include/duckpgq_state.hpp @@ -1,6 +1,7 @@ #pragma once #include "duckpgq/common.hpp" +#include "duckdb/common/case_insensitive_map.hpp" #include @@ -33,7 +34,7 @@ class DuckPGQState : public ClientContextState { // unnamed graph tables //! Property graphs that are registered - std::unordered_map> registered_property_graphs; + case_insensitive_map_t> registered_property_graphs; //! Used to build the CSR data structures required for path-finding queries std::unordered_map> csr_list; diff --git a/test/sql/create_pg/create_property_graph.test b/test/sql/create_pg/create_property_graph.test index 132a6bb..2da8a09 100644 --- a/test/sql/create_pg/create_property_graph.test +++ b/test/sql/create_pg/create_property_graph.test @@ -51,6 +51,24 @@ EDGE TABLES ( PROPERTIES ( createDate ) LABEL Knows ) +query I +-SELECT count(id) +FROM + GRAPH_TABLE (PG + MATCH p = (s1:Person)-[k:Knows]->(s2:Person WHERE s2.name='Daniel') + COLUMNS (s1.id)); +---- +0 + +query I +-SELECT count(id) +FROM + GRAPH_TABLE (PG + MATCH p = (s1:Person)-[k:Knows]->(s2:Person WHERE s2.name='Peter') + COLUMNS (s1.id)); +---- +3 + # Error as property graph pg already exists statement error -CREATE PROPERTY GRAPH pg