Skip to content

Commit

Permalink
Remove column_list argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Mar 22, 2024
1 parent ce3a0a9 commit 6abad54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
6 changes: 2 additions & 4 deletions duckpgq/include/duckpgq/functions/tablefunctions/match.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ struct PGQMatchFunction : public TableFunction {
const string &prev_binding,
const string &next_binding,
vector<unique_ptr<ParsedExpression>> &conditions,
unique_ptr<TableRef> &from_clause,
const vector<unique_ptr<ParsedExpression>> &column_list);
unique_ptr<TableRef> &from_clause);

static void EdgeTypeLeft(const shared_ptr<PropertyGraphTable> &edge_table,
const string &next_table_name,
Expand Down Expand Up @@ -130,8 +129,7 @@ struct PGQMatchFunction : public TableFunction {
vector<unique_ptr<ParsedExpression>> &conditions,
unordered_map<string, string> &alias_map,
int32_t &extra_alias_counter,
unique_ptr<TableRef> &from_clause,
vector<unique_ptr<ParsedExpression>> &column_list);
unique_ptr<TableRef> &from_clause);

static void ProcessPathList(
vector<unique_ptr<PathReference>> &path_pattern,
Expand Down
22 changes: 6 additions & 16 deletions duckpgq/src/duckpgq/functions/tablefunctions/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,18 +367,8 @@ void PGQMatchFunction::EdgeTypeAny(
const string &edge_binding, const string &prev_binding,
const string &next_binding,
vector<unique_ptr<ParsedExpression>> &conditions,
unique_ptr<TableRef> &from_clause,
const vector<unique_ptr<ParsedExpression>> &column_list) {
vector<unique_ptr<ParsedExpression>> edge_columns;
for (const auto& expr : column_list) {
const auto column_expr = dynamic_cast<ColumnRefExpression*>(expr.get());
if (column_expr == nullptr) {
continue;
}
if (column_expr->column_names[0] == edge_binding) {
edge_columns.push_back(make_uniq<ColumnRefExpression>(column_expr->column_names[1], edge_table->table_name));
}
}
unique_ptr<TableRef> &from_clause) {

// START SELECT src, dst, * from edge_table
auto src_dst_select_node = make_uniq<SelectNode>();

Expand Down Expand Up @@ -647,14 +637,14 @@ void PGQMatchFunction::AddEdgeJoins(const shared_ptr<PropertyGraphTable> &edge_t
const string &prev_binding, const string &next_binding,
vector<unique_ptr<ParsedExpression>> &conditions,
unordered_map<string, string> &alias_map, int32_t &extra_alias_counter,
unique_ptr<TableRef> &from_clause, vector<unique_ptr<ParsedExpression>> &column_list) {
unique_ptr<TableRef> &from_clause) {
if (edge_type != PGQMatchType::MATCH_EDGE_ANY) {
alias_map[edge_binding] = edge_table->table_name;
}
switch (edge_type) {
case PGQMatchType::MATCH_EDGE_ANY: {
EdgeTypeAny(edge_table, edge_binding, prev_binding, next_binding,
conditions, from_clause, column_list);
conditions, from_clause);
break;
}
case PGQMatchType::MATCH_EDGE_LEFT:
Expand Down Expand Up @@ -919,7 +909,7 @@ void PGQMatchFunction::ProcessPathList(
edge_element->variable_binding,
previous_vertex_element->variable_binding,
next_vertex_element->variable_binding, conditions,
alias_map, extra_alias_counter, from_clause, column_list);
alias_map, extra_alias_counter, from_clause);
}
} else {
// The edge element is a path element without WHERE or path-finding.
Expand All @@ -931,7 +921,7 @@ void PGQMatchFunction::ProcessPathList(
edge_element->variable_binding,
previous_vertex_element->variable_binding,
next_vertex_element->variable_binding, conditions,
alias_map, extra_alias_counter, from_clause, column_list);
alias_map, extra_alias_counter, from_clause);
// Check the edge type
// If (a)-[b]->(c) -> b.src = a.id AND b.dst = c.id
// If (a)<-[b]-(c) -> b.dst = a.id AND b.src = c.id
Expand Down

0 comments on commit 6abad54

Please sign in to comment.