uros-b commented on code in PR #56856:
URL: https://github.com/apache/spark/pull/56856#discussion_r3492633130
##########
examples/src/main/python/sql/basic.py:
##########
@@ -68,14 +68,14 @@ def basic_df_example(spark: SparkSession) -> None:
# +-------+
# Select everybody, but increment the age by 1
- df.select(df['name'], df['age'] + 1).show()
- # +-------+---------+
- # | name|(age + 1)|
- # +-------+---------+
- # |Michael| null|
- # | Andy| 31|
- # | Justin| 20|
- # +-------+---------+
+ df.select(df['name'], (df['age'] + 1).alias("age_plus_one")).show()
Review Comment:
After this, the Python tab shows column header age_plus_one, while the
sibling Scala (SparkSQLExample.scala), Java (JavaSparkSQLExample.java), and R
(RSparkSQLExample.R) examples all retain the auto-generated (age + 1) header.
I think the tabs are meant to show the same operation; differing column
names misleads readers comparing them. So, we should either alias consistently
across all four languages or leave Python as-is. cc @Yicong-Huang to provide an
opinion here ^^
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]