Github user actuaryzhang commented on the issue:

    https://github.com/apache/spark/pull/17159
  
    @felixcheung  OK, did not know it was by design. It does seem that the 
`union` behavior is similar to R's SQL (in `sqldf`), but as you pointed out, 
the overload method `rbind` is different from base R, which checks  name 
consistency. See examples below. Should I make the change to `rbind`, or leave 
it as is and close this PR? Thanks.
    
    ```
    df <- data.frame(name = c("Michael", "Andy", "Justin"), age = c(1, 30, 19))
    df2 <- df
    names(df2)[1] <- "name2"
    
    # 1. SQL
    library(sqldf)
    query <- "select * from df union all select * from df2"
    sqldf(query)
    
         name age
    1 Michael   1
    2    Andy  30
    3  Justin  19
    4 Michael   1
    5    Andy  30
    6  Justin  19
    
    # 2. rbind
    rbind(df, df2)
    Error in match.names(clabs, names(xi)) : 
      names do not match previous names
    ```


---
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