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

[SPARK-48336][PS][CONNECT] Implement ps.sql in Spark Connect #46658

Closed
wants to merge 2 commits into from

Conversation

zhengruifeng
Copy link
Contributor

What changes were proposed in this pull request?

Implement ps.sql in Spark Connect

Why are the changes needed?

feature parity in Spark Connect

Does this PR introduce any user-facing change?

yes:

In [4]: spark
Out[4]: <pyspark.sql.connect.session.SparkSession at 0x105136390>

In [5]:     >>> ps.sql('''
   ...:     ...   SELECT m1.a, m2.b
   ...:     ...   FROM {table1} m1 INNER JOIN {table2} m2
   ...:     ...   ON m1.key = m2.key
   ...:     ...   ORDER BY m1.a, m2.b''',
   ...:     ...   table1=ps.DataFrame({"a": [1,2], "key": ["a", "b"]}),
   ...:     ...   table2=pd.DataFrame({"b": [3,4,5], "key": ["a", "b", "b"]}))
/Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1018: PandasAPIOnSparkAdviceWarning: The config 'spark.sql.ansi.enabled' is set to True. This can cause unexpected behavior from pandas API on Spark since pandas API on Spark follows the behavior of pandas, not SQL.
  warnings.warn(message, PandasAPIOnSparkAdviceWarning)
/Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1018: PandasAPIOnSparkAdviceWarning: The config 'spark.sql.ansi.enabled' is set to True. This can cause unexpected behavior from pandas API on Spark since pandas API on Spark follows the behavior of pandas, not SQL.
  warnings.warn(message, PandasAPIOnSparkAdviceWarning)

   a  b
0  1  3
1  2  4
2  2  5

How was this patch tested?

  1. enabled UTs
  2. also manually tested all the examples

Was this patch authored or co-authored using generative AI tooling?

No

@zhengruifeng
Copy link
Contributor Author

cc @itholic and @HyukjinKwon

@zhengruifeng
Copy link
Contributor Author

merged to master

@itholic
Copy link
Contributor

itholic commented May 22, 2024

Late LGTM. Thanks for addressing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants