Skip to content

Commit

Permalink
Renamed path_list to path_patterns to avoid confusion with subpath pa…
Browse files Browse the repository at this point in the history
…th_list
  • Loading branch information
Dtenwolde committed Aug 11, 2023
1 parent 5d3ee94 commit ccfa69c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/include/duckdb/parser/tableref/matchref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MatchExpression : public ParsedExpression {

string pg_name;
string alias;
vector<unique_ptr<PathPattern>> path_list;
vector<unique_ptr<PathPattern>> path_patterns;

vector<unique_ptr<ParsedExpression>> column_list;

Expand Down
20 changes: 10 additions & 10 deletions src/parser/tableref/matchref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ string MatchExpression::ToString() const {
string result = "GRAPH_TABLE (";
result += pg_name + " MATCH";

for (idx_t i = 0; i < path_list.size(); i++) {
for (idx_t i = 0; i < path_patterns.size(); i++) {
(i > 0) ? result += ", " : result;
for (idx_t j = 0; j < path_list[i]->path_elements.size(); j++) {
auto &path_reference = path_list[i]->path_elements[j];
for (idx_t j = 0; j < path_patterns[i]->path_elements.size(); j++) {
auto &path_reference = path_patterns[i]->path_elements[j];
switch (path_reference->path_reference_type) {
case PGQPathReferenceType::PATH_ELEMENT: {
auto path_element = reinterpret_cast<PathElement *>(path_reference.get());
Expand Down Expand Up @@ -64,13 +64,13 @@ bool MatchExpression::Equals(const BaseExpression &other_p) const {
return false;
}

if (path_list.size() != other.path_list.size()) {
if (path_patterns.size() != other.path_patterns.size()) {
return false;
}

// path_list
for (idx_t i = 0; i < path_list.size(); i++) {
if (!path_list[i]->Equals(other.path_list[i].get())) {
for (idx_t i = 0; i < path_patterns.size(); i++) {
if (!path_patterns[i]->Equals(other.path_patterns[i].get())) {
return false;
}
}
Expand Down Expand Up @@ -104,8 +104,8 @@ unique_ptr<ParsedExpression> MatchExpression::Copy() const {
copy->pg_name = pg_name;
copy->alias = alias;

for (auto &path : path_list) {
copy->path_list.push_back(path->Copy());
for (auto &path : path_patterns) {
copy->path_patterns.push_back(path->Copy());
}

for (auto &column : column_list) {
Expand All @@ -120,7 +120,7 @@ unique_ptr<ParsedExpression> MatchExpression::Copy() const {
void MatchExpression::Serialize(FieldWriter &writer) const {
writer.WriteString(pg_name);
writer.WriteString(alias);
writer.WriteSerializableList<PathPattern>(path_list);
writer.WriteSerializableList<PathPattern>(path_patterns);
writer.WriteSerializableList<ParsedExpression>(column_list);
writer.WriteOptional(where_clause);
}
Expand All @@ -129,7 +129,7 @@ unique_ptr<ParsedExpression> MatchExpression::Deserialize(FieldReader &reader) {
auto result = make_uniq<MatchExpression>();
result->pg_name = reader.ReadRequired<string>();
result->alias = reader.ReadRequired<string>();
result->path_list = reader.ReadRequiredSerializableList<PathPattern>();
result->path_patterns = reader.ReadRequiredSerializableList<PathPattern>();
result->column_list = reader.ReadRequiredSerializableList<ParsedExpression>();
result->where_clause = reader.ReadOptional<ParsedExpression>(nullptr);
return std::move(result);
Expand Down
2 changes: 1 addition & 1 deletion src/parser/transform/tableref/transform_match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ unique_ptr<TableRef> Transformer::TransformMatch(duckdb_libpgquery::PGMatchClaus
for (auto node = root.paths->head; node != nullptr; node = lnext(node)) {
auto path = reinterpret_cast<duckdb_libpgquery::PGPathPattern *>(node->data.ptr_value);
auto transformed_path = TransformPath(path);
match_info->path_list.push_back(std::move(transformed_path));
match_info->path_patterns.push_back(std::move(transformed_path));
}

for (auto node = root.columns->head; node != nullptr; node = lnext(node)) {
Expand Down

0 comments on commit ccfa69c

Please sign in to comment.