From 5a9b74dd8abe24ba7b6a358c75cbf6ebff77e8c5 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Wed, 17 Jan 2024 16:59:09 +0100 Subject: [PATCH] Remove commented out code --- .../functions/tablefunctions/match.cpp | 213 ------------------ 1 file changed, 213 deletions(-) diff --git a/duckpgq/src/duckpgq/functions/tablefunctions/match.cpp b/duckpgq/src/duckpgq/functions/tablefunctions/match.cpp index 73e753c8..941c346a 100644 --- a/duckpgq/src/duckpgq/functions/tablefunctions/match.cpp +++ b/duckpgq/src/duckpgq/functions/tablefunctions/match.cpp @@ -743,7 +743,6 @@ namespace duckdb { PathElement* previous_vertex_element = GetPathElement(path_list[0]); if (!previous_vertex_element) { - // todo(dtenwolde) handle named subpaths. const auto previous_vertex_subpath = reinterpret_cast(path_list[0].get()); if (previous_vertex_subpath->where_clause) { conditions.push_back(std::move(previous_vertex_subpath->where_clause)); @@ -808,7 +807,6 @@ namespace duckdb { conditions.push_back(std::move(edge_subpath->where_clause)); } if (edge_subpath->path_list.size() > 1) { - // todo(dtenwolde) deal with multiple elements in subpath throw NotImplementedException("Subpath on an edge is not yet supported."); } edge_element = GetPathElement(edge_subpath->path_list[0]); @@ -960,215 +958,4 @@ namespace duckdb { return std::move(result); } - - // - //unique_ptr PGQMatchFunction::GenerateSubpathPatternSubquery( - // unique_ptr &path_pattern, CreatePropertyGraphInfo *pg_table, - // vector> &column_list, - // unordered_set &named_subpaths) { - // vector> conditions; - // auto path_element = - // reinterpret_cast(path_pattern->path_elements[0].get()); - // auto select_node = make_uniq(); - // unordered_map alias_map; - // string named_subpath = path_element->path_variable; - // named_subpaths.insert(named_subpath); - // int32_t extra_alias_counter = 0; - // bool path_finding = false; - // auto previous_vertex_element = - // GetPathElement(path_element->path_list[0], conditions); - // auto previous_vertex_table = - // FindGraphTable(previous_vertex_element->label, *pg_table); - // CheckInheritance(previous_vertex_table, previous_vertex_element, conditions); - // alias_map[previous_vertex_element->variable_binding] = - // previous_vertex_table->table_name; - // for (idx_t idx_j = 1; idx_j < path_element->path_list.size(); - // idx_j = idx_j + 2) { - // PathElement *edge_element = - // GetPathElement(path_element->path_list[idx_j], conditions); - // PathElement *next_vertex_element = - // GetPathElement(path_element->path_list[idx_j + 1], conditions); - // if (next_vertex_element->match_type != PGQMatchType::MATCH_VERTEX || - // previous_vertex_element->match_type != PGQMatchType::MATCH_VERTEX) { - // throw BinderException("Vertex and edge patterns must be alternated."); - // } - // - // auto edge_table = FindGraphTable(edge_element->label, *pg_table); - // CheckInheritance(edge_table, edge_element, conditions); - // auto next_vertex_table = - // FindGraphTable(next_vertex_element->label, *pg_table); - // CheckInheritance(next_vertex_table, next_vertex_element, conditions); - // - // if (path_element->path_list[idx_j]->path_reference_type == - // PGQPathReferenceType::SUBPATH) { - // auto *subpath = - // reinterpret_cast(path_element->path_list[idx_j].get()); - // if (subpath->upper > 1) { - // path_finding = true; - // if (!named_subpath.empty() && path_pattern->shortest) { - // // todo(dtenwolde) does not necessarily have to be a shortest path - // // query if it is a named subpath. It can also be a basic pattern - // // matching that is named. - // auto shortest_path_function = CreatePathFindingFunction( - // previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, edge_table, - // "shortestpath"); - // shortest_path_function->alias = "path"; - // select_node->select_list.push_back(std::move(shortest_path_function)); - // } - // select_node->cte_map.map["cte1"] = - // CreateCSRCTE(edge_table, previous_vertex_element->variable_binding, - // edge_element->variable_binding, - // next_vertex_element->variable_binding); - // - // //! (SELECT count(cte1.temp) * 0 as temp from cte1) __x - // auto temp_cte_select_subquery = CreateCountCTESubquery(); - // - // auto cross_join_src_dst = make_uniq(JoinRefType::CROSS); - // - // //! src alias (FROM src a) - // auto src_vertex_ref = make_uniq(); - // src_vertex_ref->table_name = edge_table->source_reference; - // src_vertex_ref->alias = previous_vertex_element->variable_binding; - // - // cross_join_src_dst->left = std::move(src_vertex_ref); - // - // //! dst alias (FROM dst b) - // auto dst_vertex_ref = make_uniq(); - // dst_vertex_ref->table_name = edge_table->destination_reference; - // dst_vertex_ref->alias = next_vertex_element->variable_binding; - // - // cross_join_src_dst->right = std::move(dst_vertex_ref); - // - // auto cross_join_with_cte = make_uniq(JoinRefType::CROSS); - // cross_join_with_cte->left = std::move(temp_cte_select_subquery); - // cross_join_with_cte->right = std::move(cross_join_src_dst); - // - // if (select_node->from_table) { - // // create a cross join since there is already something in the from - // // clause - // auto from_join = make_uniq(JoinRefType::CROSS); - // from_join->left = std::move(select_node->from_table); - // from_join->right = std::move(cross_join_with_cte); - // select_node->from_table = std::move(from_join); - // } else { - // select_node->from_table = std::move(cross_join_with_cte); - // } - // //! END - // //! FROM (SELECT count(cte1.temp) * 0 as temp from cte1) __x, src a, dst b - // - // //! START - // //! WHERE __x.temp + iterativelength(, (SELECT count(c.id) from - // //! dst c, a.rowid, b.rowid) between lower and upper - // auto reachability_function = - // CreatePathFindingFunction(previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, - // edge_table, "iterativelength"); - // - // auto cte_col_ref = make_uniq("temp", "__x"); - // - // vector> addition_children; - // addition_children.push_back(std::move(cte_col_ref)); - // addition_children.push_back(std::move(reachability_function)); - // - // auto addition_function = - // make_uniq("add", std::move(addition_children)); - // auto lower_limit = - // make_uniq(Value::BIGINT(subpath->lower)); - // auto upper_limit = - // make_uniq(Value::BIGINT(subpath->upper)); - // auto between_expression = make_uniq( - // std::move(addition_function), std::move(lower_limit), - // std::move(upper_limit)); - // conditions.push_back(std::move(between_expression)); - // - // //! END - // //! WHERE __x.temp + iterativelength(, (SELECT count(s.id) from - // //! src s, a.rowid, b.rowid) between lower and upper - // } - // // check aliases - // alias_map[next_vertex_element->variable_binding] = - // next_vertex_table->table_name; - // alias_map[edge_element->variable_binding] = edge_table->table_name; - // if (!path_finding) { - // switch (edge_element->match_type) { - // case PGQMatchType::MATCH_EDGE_ANY: { - // select_node->modifiers.push_back(make_uniq()); - // EdgeTypeAny(edge_table, edge_element->variable_binding, - // previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, conditions); - // break; - // } - // case PGQMatchType::MATCH_EDGE_LEFT: - // EdgeTypeLeft(edge_table, next_vertex_table->table_name, - // previous_vertex_table->table_name, - // edge_element->variable_binding, - // previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, conditions); - // break; - // case PGQMatchType::MATCH_EDGE_RIGHT: - // EdgeTypeRight(edge_table, next_vertex_table->table_name, - // previous_vertex_table->table_name, - // edge_element->variable_binding, - // previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, conditions); - // break; - // case PGQMatchType::MATCH_EDGE_LEFT_RIGHT: { - // EdgeTypeLeftRight(edge_table, edge_element->variable_binding, - // previous_vertex_element->variable_binding, - // next_vertex_element->variable_binding, conditions, - // alias_map, extra_alias_counter); - // break; - // } - // default: - // throw InternalException("Unknown match type found"); - // } - // } - // previous_vertex_element = next_vertex_element; - // previous_vertex_table = next_vertex_table; - // } - // } - // - // select_node->where_clause = CreateWhereClause(conditions); - // vector> substitute_column_list; - // for (auto &expression : column_list) { - // const auto &column_ref = - // dynamic_cast(expression.get()); - // if (column_ref == nullptr) { - // continue; - // } - // // If the table is referenced in this subquery (count() > 0) - // if (alias_map.count(column_ref->column_names[0])) { - // select_node->select_list.push_back(std::move(expression)); - // // Create a substitute - // unique_ptr new_upper_column_ref; - // if (column_ref->alias.empty()) { - // new_upper_column_ref = make_uniq( - // column_ref->column_names[1], named_subpath); - // } else { - // new_upper_column_ref = - // make_uniq(column_ref->alias, named_subpath); - // } - // new_upper_column_ref->alias = column_ref->alias; - // substitute_column_list.push_back(std::move(new_upper_column_ref)); - // } - // } - // // Remove the elements from the original column_list that are now NULL - // for (auto it = column_list.begin(); it != column_list.end();) { - // if (!*it) { - // it = column_list.erase(it); - // } else { - // ++it; - // } - // } - // // Add the ColumnRefs that were previously moved to the subquery with the - // // subquery name as table_name - // for (auto &expression : substitute_column_list) { - // column_list.push_back(std::move(expression)); - // } - // auto subquery = make_uniq(); - // subquery->node = std::move(select_node); - // - // return make_uniq(std::move(subquery), named_subpath); - //} } // namespace duckdb