Frederik Paradis created SPARK-43439:
----------------------------------------
Summary: Drop does not work when passed a string with an alias
Key: SPARK-43439
URL: https://issues.apache.org/jira/browse/SPARK-43439
Project: Spark
Issue Type: Bug
Components: PySpark
Affects Versions: 3.3.2
Reporter: Frederik Paradis
When passing a string to the drop method, if the string contains an alias, the
column is not dropped. However, passing a column object with the same name and
alias, it works.
{code:python}
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
spark =
SparkSession.builder.master("local[1]").appName("local-spark-session").getOrCreate()
df1 = spark.createDataFrame([(1, 10)], ["any", "hour"]).alias("a")
j = df1.drop("a.hour")
print(j) # DataFrame[any: bigint, hour: bigint]
jj = df1.drop(F.col("a.hour"))
print(jj) # DataFrame[any: bigint]
{code}
Related issues:
https://issues.apache.org/jira/browse/SPARK-31123
https://issues.apache.org/jira/browse/SPARK-14759
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]