Skip to content

fix: resolve AttributeError in pageRank on Spark Connect (issue #889) - #890

Merged
SemyonSinchenko merged 1 commit into
graphframes:mainfrom
MCBoarder289:fix-889-spark-connect-page-rank
Aug 26, 2026
Merged

SemyonSinchenko merged 1 commit into
graphframes:mainfrom
MCBoarder289:fix-889-spark-connect-page-rank

Conversation

@MCBoarder289

Copy link
Copy Markdown
Contributor

This should address issue #889. Here is the commit details:

GraphFrameConnect._update_page_rank_edge_weights referenced self.edges (no public attribute — only self._edges exists) and self.outDegrees (not defined on GraphFrameConnect), causing AttributeError when calling pageRank() via Spark Connect.

  • Add outDegrees property to GraphFrameConnect
  • Fix self.edges.columns → self._edges.columns

Add regression test test_graphframes_pagerank covering the pageRank API.

What changes were proposed in this pull request?

Two fixes to GraphFrameConnect in python/graphframes/connect/graphframes_client.py:

  1. Added outDegrees property — GraphFrameConnect was missing this property
    (present on GraphFrame) which is required by the pageRank algorithm internally.

  2. Fixed attribute reference in _update_page_rank_edge_weights — changed
    self.edges.columns → self._edges.columns. GraphFrameConnect exposes no
    public edges attribute; the backing DataFrame is self._edges.

A regression test test_graphframes_pagerank is added to python/tests/test_graphframes.py
to cover the pageRank() API via Spark Connect end-to-end.

Why are the changes needed?

Calling pageRank() on a GraphFrameConnect instance raised AttributeError in two
places due to incorrect attribute references introduced when porting the algorithm to the
Connect client:

  • self.edges → AttributeError: 'GraphFrameConnect' object has no attribute 'edges'
  • self.outDegrees → AttributeError: 'GraphFrameConnect' object has no attribute 'outDegrees'

Both errors are surfaced immediately on any pageRank() call via Spark Connect, making
the feature completely unusable in Connect mode. This PR fixes both issues and adds a
test to prevent regression. Fixes #889.

…frames#889)

GraphFrameConnect._update_page_rank_edge_weights referenced self.edges
(no public attribute — only self._edges exists) and self.outDegrees
(not defined on GraphFrameConnect), causing AttributeError when calling
pageRank() via Spark Connect.

- Add outDegrees property to GraphFrameConnect
- Fix self.edges.columns → self._edges.columns

Add regression test test_graphframes_pagerank covering the pageRank API.

@SemyonSinchenko SemyonSinchenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~LGTM

@SemyonSinchenko
SemyonSinchenko merged commit 714cad7 into graphframes:main Aug 26, 2026
11 checks passed
@SemyonSinchenko

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Spark Connect Page Rank Errors

2 participants