-
Notifications
You must be signed in to change notification settings - Fork 210
feat: Add support for spark connect #2417
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6a6e420
WIP
FBruzzesi 27b66f7
Down to handful of tests
FBruzzesi 6531ced
CI?
FBruzzesi cdacf63
add pyspark-connect option in optional deps
FBruzzesi 5f4fe4e
no cover, forgot dash in CI
FBruzzesi d32d5dc
3.5.1 not found -> move to 3.5.5, rm spark remote variable for vanillβ¦
FBruzzesi 0e5cc73
get_spark_connect to actually return connect
FBruzzesi 8b61581
Merge branch 'main' into feat/spark-connect
FBruzzesi 05e0bcc
one more try
FBruzzesi 73ff548
more window warnings, pass pyarrow schema in collect
FBruzzesi 2a6d742
it work :)
FBruzzesi c646706
refactor conftest
FBruzzesi 97b31ef
use env vars instead
FBruzzesi 9c5a5de
add spark cache
FBruzzesi 769dbef
Merge branch 'main' into feat/spark-connect
FBruzzesi bcbec71
retry caching
FBruzzesi 2f09e15
Merge branch 'feat/spark-connect' of https://github.com/narwhals-dev/β¦
FBruzzesi 94e650e
Merge branch 'main' into feat/spark-connect
FBruzzesi 67eaac3
Edo's feedback
FBruzzesi f297ac4
test(typing): Fix `pyspark_lazy_constructor`
dangotbanned adc698c
Merge branch 'main' into feat/spark-connect
FBruzzesi 71135cb
use same java as in spark
FBruzzesi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,13 @@ def _collect_to_arrow(self) -> pa.Table: | |
| return pa.Table.from_pydict(data, schema=pa.schema(schema)) | ||
| else: # pragma: no cover | ||
| raise | ||
| elif ( | ||
| self._implementation is Implementation.PYSPARK_CONNECT | ||
| and self._backend_version < (4,) | ||
| ): | ||
| import pyarrow as pa # ignore-banned-import | ||
|
|
||
| return pa.Table.from_pandas(self.native.toPandas()) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This...got me a laugh and a tear! |
||
| else: | ||
| return self.native.toArrow() | ||
|
|
||
|
|
@@ -294,7 +301,7 @@ def drop(self, columns: Sequence[str], *, strict: bool) -> Self: | |
| return self._with_native(self.native.drop(*columns_to_drop)) | ||
|
|
||
| def head(self, n: int) -> Self: | ||
| return self._with_native(self.native.limit(num=n)) | ||
| return self._with_native(self.native.limit(n)) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No argument named |
||
|
|
||
| def group_by(self, *keys: str, drop_null_keys: bool) -> SparkLikeLazyGroupBy: | ||
| from narwhals._spark_like.group_by import SparkLikeLazyGroupBy | ||
|
|
@@ -444,7 +451,10 @@ def explode(self, columns: Sequence[str]) -> Self: | |
| ) | ||
| raise NotImplementedError(msg) | ||
|
|
||
| if self._implementation.is_pyspark(): | ||
| if self._implementation in { | ||
| Implementation.PYSPARK, | ||
| Implementation.PYSPARK_CONNECT, | ||
| }: | ||
| return self._with_native( | ||
| self.native.select( | ||
| *[ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.