Tim Meehan created SPARK-61287:
----------------------------------
Summary: Keep the column as the left operand of a reflected & and
| in the Python client, as PySpark does
Key: SPARK-61287
URL: https://issues.apache.org/jira/browse/SPARK-61287
Project: Spark
Issue Type: Bug
Components: Connect
Affects Versions: connect-rust-4.3.0
Reporter: Tim Meehan
In PySpark, True & col and True | col build (col AND true) and (col OR true):
Column.__rand__ and __ror__ keep the column as the left operand
(pyspark/sql/connect/column.py:241, :246). In the Python client of
spark-connect-rust, they build (true AND col) and (true OR col), so the names
of the resulting columns differ.
{code:python}
from pyspark.sql import SparkSession, functions as F
spark = SparkSession.builder.remote("sc://localhost:15002").getOrCreate()
df = spark.range(2).select((F.col("id") > 0).alias("b"))
print(df.select(True & F.col("b"), True | F.col("b")).columns)
{code}
Against an OSS Spark 4.3.0 Connect server on loopback:
* pyspark-client 4.3.0: \['(b AND true)', '(b OR true)'\], the same as for
F.col("b") & True and F.col("b") | True.
* spark-connect-rust master 8768cc4: \['(true AND b)', '(true OR b)'\].
>From source: __rand__ and __ror__ build other.and(self) and other.or(self)
>(crates/pyspark-rs/src/column.rs:811, :816).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]