Skip to content

Conversation

@cvvergara
Copy link
Member

Fixes #2899

Changes proposed in this pull request:

  • Remove SQL deprecated signatures and functions
  • pgtap tests to be done only on existing SQL functions
  • Keeping deprecated internal C function
    • Moving to legacy will happen on v5

@coderabbitai summary

@pgRouting/admins

@cvvergara cvvergara added this to the Release 4.0.0 milestone May 24, 2025
@cvvergara cvvergara requested a review from robe2 May 24, 2025 19:20
@cvvergara cvvergara added Flow Remove rm of deprecated function or internal function labels May 24, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 24, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cvvergara cvvergara marked this pull request as draft May 24, 2025 19:29
cvvergara added 4 commits May 24, 2025 18:03
- sql: internal function retuns only the edge
- C++ code
  - new class for undirected graphs without cost
  - Instead of a class, maxCardinalityMatch function
  - Moving code from header to implementation file
- driver returns integer array, builds graph and makes call to maxCardinalityMatch function
- Adjusting C code because of driver returning an integer array
- Adding the new files to the build
- Removing deprecated internal function _pgr_maxCardinalityMatch
- Removing deprecated C code to legacy and adjusting remaining C code
- (pgtap) Testing only valid signatures in 4.0.0
- Keeping the deprecated C code for the duration of v4
@cvvergara cvvergara force-pushed the remove-deprecated-signatures-of-pgr_maxCardinalityMatch branch from 3740d79 to 15b8709 Compare May 25, 2025 00:08
@cvvergara cvvergara marked this pull request as ready for review May 25, 2025 00:17
@cvvergara
Copy link
Member Author

@coderabbitai summary
@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 25, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@cvvergara I'll gather the information about this PR and provide both a summary and review. Let me first examine the changes in this pull request.


🏁 Script executed:

#!/bin/bash
# Get basic information about the PR
gh pr view 2900 --json title,body,author,baseRefName,headRefName,files,additions,deletions

# Get the list of changed files with their status
gh pr diff 2900 --name-status

# Get the actual diff to understand the changes
gh pr diff 2900

Length of output: 43250


@cvvergara Here's the summary and review for PR #2900:

Summary

This PR removes deprecated signatures of pgr_maxCardinalityMatch function as part of the v4.0.0 cleanup. The changes include:

Key Changes:

  • API Simplification: Removes the deprecated pgr_maxCardinalityMatch(text, boolean) signature, keeping only pgr_maxCardinalityMatch(text)
  • New Infrastructure: Introduces UndirectedNoCostsBG class for handling undirected graphs without costs
  • Return Type Change: Function now returns SETOF BIGINT (edge IDs only) instead of the previous record structure with sequence, edge, source, and target
  • Code Refactoring: Moves from inline graph construction to a dedicated graph class with proper separation of concerns

Files Modified:

  • 24 files with 385 additions and 323 deletions
  • New files: undirectedNoCostBG.hpp/cpp, updated maximumcardinalitymatching.cpp
  • Updated SQL definitions, tests, documentation, and release notes

Review

✅ Strengths

  1. Clean API Design: Removing the directed parameter simplifies the API since maximum cardinality matching is inherently for undirected graphs.

  2. Better Code Organization: The new UndirectedNoCostsBG class provides a clean abstraction for undirected graphs:

class UndirectedNoCostsBG {
    using G = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>;
    // Clean interface with proper encapsulation
};
  1. Improved Function Interface: The new internal function _pgr_maxCardinalityMatch_v4 has a cleaner signature:
void pgr_do_maximum_cardinality_matching(
    const char *edges_sql,
    int64_t **return_tuples,  // Simplified return type
    size_t *return_count,
    // ... error handling
);
  1. Comprehensive Test Updates: All test files have been properly updated to reflect the API changes.

🔍 Areas for Attention

  1. Memory Management: In undirectedNoCostBG.cpp, ensure proper cleanup:
if (edge.going) {
    boost::tie(e, added) = boost::add_edge(v1, v2, graph);
    if (added) E_to_id.insert(std::pair<E, int64_t>(e, edge.id));
}

The conditional insertion looks correct, but verify edge deduplication behavior.

  1. Error Handling: In maximumcardinalitymatching.cpp:
boost::tie(e, exists) = boost::edge(v1, v2, graph());
if (!exists) throw;  // Consider more descriptive error

The bare throw should probably throw a more specific exception.

  1. Legacy Function: The deprecated _pgr_maxcardinalitymatch function is kept but returns dummy values:
values[0] = 0;  // seq
values[1] = Int64GetDatum(result_tuples[funcctx->call_cntr]);  // edge
values[2] = 0;  // source  
values[3] = 0;  // target

Consider adding a deprecation warning when this function is called.

📋 Recommendations

  1. Exception Handling: Replace bare throw with descriptive exceptions:
if (!exists) {
    throw std::runtime_error("Edge does not exist in matching result");
}
  1. Documentation: Consider adding inline documentation for the new UndirectedNoCostsBG class methods.

  2. Validation: Add validation in the constructor to ensure edges reference valid vertices.

✅ Overall Assessment

This is a well-executed refactoring that successfully:

  • Removes deprecated functionality as planned for v4.0.0
  • Introduces cleaner abstractions
  • Maintains backward compatibility where needed
  • Updates all related components consistently

The code quality is good and the approach is sound. The changes align well with the goal of cleaning up the API for the major version release.

@cvvergara cvvergara merged commit a6dd957 into pgRouting:develop May 26, 2025
25 of 26 checks passed
@cvvergara cvvergara deleted the remove-deprecated-signatures-of-pgr_maxCardinalityMatch branch May 26, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Flow Remove rm of deprecated function or internal function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants