Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17159
  
    hmm... this is somewhat by design - `union` could take in 2 DataFrames that 
might not match in column names or type. In that case values in one of the 
DataFrame will be coerced to make things fit
    ```
    >>> d = spark.createDataFrame([{'name': 'Alice', 'age': 1}])
    >>> l = spark.createDataFrame([(1, 2)])
    >>> d.union(l).head(2)
    [Row(age=1, name=u'Alice'), Row(age=1, name=u'2')]
    
    >>> l.dtypes
    [('_1', 'bigint'), ('_2', 'bigint')]
    >>> d.dtypes
    [('age', 'bigint'), ('name', 'string')]
    ```
    
    Do you see this as something that might be unexpected for R users (in which 
case `rbind` might be the overload to look into) or SQL users (documented as 
equivalent to SQL UNION ALL)?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to