ueshin commented on code in PR #50286: URL: https://github.com/apache/spark/pull/50286#discussion_r1999339256
########## python/pyspark/sql/tests/test_dataframe.py: ########## @@ -1076,6 +1076,32 @@ def test_metadata_column(self): [Row(0), Row(0), Row(0)], ) + def test_with_column_and_generator(self): + # SPARK-51451: Generators should be available with withColumn + df = self.spark.createDataFrame([("082017",)], ["dt"]).select( + to_date(col("dt"), "MMyyyy").alias("dt") + ) + df_dt = df.withColumn("dt", date_format(col("dt"), "MM/dd/yyyy")) + monthArray = [lit(x) for x in range(0, 12)] + df_month_y = df_dt.withColumn("month_y", explode(array(monthArray))) Review Comment: For this example, its parsed plan is: ``` == Parsed Logical Plan == 'Project [unresolvedstarwithcolumns(month_y, 'explode('array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)), None)] +- Project [date_format(cast(to_date(dt#0, Some(MMyyyy), Some(America/Los_Angeles), true) as timestamp), MM/dd/yyyy, Some(America/Los_Angeles)) AS dt#1] +- LogicalRDD [dt#0], false ``` Here `explode` is nested in `unresolvedstarwithcolumns`. I also updated the description. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org