Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions python/graphframes/graphframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ def is_remote() -> bool:
from graphframes.classic.graphframe import GraphFrame as GraphFrameClassic
from graphframes.lib import Pregel

if __version__[:3] >= "3.4":
from graphframes.connect.graphframe_client import GraphFrameConnect
else:

class GraphFrameConnect:
def __init__(self, *args, **kwargs) -> None:
raise ValueError("Unreachable error happened!")


if TYPE_CHECKING:
from pyspark.sql import Column, DataFrame

from graphframes.connect.graphframe_client import GraphFrameConnect


class GraphFrame:
"""
Expand All @@ -67,11 +60,14 @@ class GraphFrame:
"""

@staticmethod
def _from_impl(impl: GraphFrameClassic | GraphFrameConnect) -> "GraphFrame":
def _from_impl(impl: GraphFrameClassic | "GraphFrameConnect") -> "GraphFrame":
return GraphFrame(impl.vertices, impl.edges)

def __init__(self, v: DataFrame, e: DataFrame) -> None:
self._impl: GraphFrameClassic | "GraphFrameConnect"
if is_remote():
from graphframes.connect.graphframe_client import GraphFrameConnect

self._impl = GraphFrameConnect(v, e)
else:
self._impl = GraphFrameClassic(v, e)
Expand Down