HyukjinKwon commented on code in PR #42513:
URL: https://github.com/apache/spark/pull/42513#discussion_r1302846694
##########
python/pyspark/sql/dataframe.py:
##########
@@ -3908,8 +3908,21 @@ def union(self, other: "DataFrame") -> "DataFrame":
Example 2: Combining two DataFrames with different schemas
>>> from pyspark.sql.functions import lit
- >>> df1 = spark.createDataFrame([("Alice", 1), ("Bob", 2)], ["name",
"id"])
- >>> df2 = spark.createDataFrame([(3, "Charlie"), (4, "Dave")], ["id",
"name"])
+ >>> from pyspark.sql.types import StructType, StructField, StringType
+ >>> schema1 = StructType(
Review Comment:
Can you also use a different type? e.g., `LongType` vs `IntegerType`.
Also, you can specify the type via DDL string format that I think is simpler.
e.g., `schema="v1 LONG, v2 INT"`
--
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]