Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Fixed PySpark docstrings and changed some public function to private. #2018

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ci/azure/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
displayName: 'Lint'

# TODO: change match-dir when docstrings are fixed for other backends
- bash: docker-compose run ibis pydocstyle --match-dir="(ibis|omniscidb)"
- bash: docker-compose run ibis pydocstyle -v --match-dir="(ibis|omniscidb|pyspark)"
displayName: "Docstring check"

- bash: docker-compose run ibis black --check .
Expand Down
1 change: 1 addition & 0 deletions ibis/pyspark/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""PySpark backend."""
15 changes: 13 additions & 2 deletions ibis/pyspark/api.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
"""PySpark backend API module."""
from ibis.pyspark.client import PySparkClient
from ibis.pyspark.compiler import dialect # noqa: F401


def connect(session):
"""
Create a `SparkClient` for use with Ibis. Pipes **kwargs into SparkClient,
which pipes them into SparkContext. See documentation for SparkContext:
Create a `SparkClient` for use with Ibis.

Pipes **kwargs into SparkClient, which pipes them into SparkContext.
See documentation for SparkContext:
https://spark.apache.org/docs/latest/api/python/_modules/pyspark/context.html#SparkContext

Parameters
----------
session

Returns
-------
client : PySparkClient
"""
client = PySparkClient(session)

Expand Down
10 changes: 4 additions & 6 deletions ibis/pyspark/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""PySpark backend client module."""
from pyspark.sql.column import Column

import ibis.common.exceptions as com
Expand All @@ -8,9 +9,7 @@


class PySparkClient(SparkClient):
"""
An ibis client that uses PySpark SQL Dataframe
"""
"""An ibis client that uses PySpark SQL Dataframe."""

dialect = PySparkDialect
table_class = PySparkTable
Expand All @@ -20,9 +19,7 @@ def __init__(self, session):
self.translator = PySparkExprTranslator()

def compile(self, expr, params=None, *args, **kwargs):
"""Compile an ibis expression to a PySpark DataFrame object
"""

"""Compile an ibis expression to a PySpark DataFrame object."""
# Insert params in scope
if params is None:
scope = {}
Expand All @@ -33,6 +30,7 @@ def compile(self, expr, params=None, *args, **kwargs):
return self.translator.translate(expr, scope=scope)

def execute(self, expr, params=None, limit='default', **kwargs):
"""Execute given expression using PySpark."""
if isinstance(expr, types.TableExpr):
return self.compile(expr, params, **kwargs).toPandas()
elif isinstance(expr, types.ColumnExpr):
Expand Down
Loading