renato2099 commented on issue #1305:
URL: 
https://github.com/apache/datafusion-python/issues/1305#issuecomment-3667438114

   > I've opened a PR that uses coalesce instead of dropping the left column.  
Using coalesce seems the right approach since:
   
   cool! thanks @mesejo ! yeah it is definitely an option :) 
   
   For me, it depends on how much SQL like we want/need to be + let the user 
decide the next operation (and hopefully an optimizer fuse operators together 
where it makes sense)
   
   looking at how polars does it, it is interesting to see that columns get 
properly "renamed" such that users can also decide afterwards
   ```
   import polars as pl
   
   df = pl.DataFrame(
       {
           "foo": [1, 2, 3],
           "bar": [6.0, 7.0, 8.0],
           "ham": ["a", "b", "c"],
       }
   )
   other_df = pl.DataFrame(
       {
           "apple": ["x", "y", "z"],
           "ham": ["a", "b", "d"],
       }
   )
   
   out = df.join(other_df, on="ham", how="full")
   print(out)
   
   shape: (4, 5)
   ┌──────┬──────┬──────┬───────┬───────────┐
   │ foo  ┆ bar  ┆ ham  ┆ apple ┆ ham_right │
   │ ---  ┆ ---  ┆ ---  ┆ ---   ┆ ---       │
   │ i64  ┆ f64  ┆ str  ┆ str   ┆ str       │
   ╞══════╪══════╪══════╪═══════╪═══════════╡
   │ 1    ┆ 6.0  ┆ a    ┆ x     ┆ a         │
   │ 2    ┆ 7.0  ┆ b    ┆ y     ┆ b         │
   │ null ┆ null ┆ null ┆ z     ┆ d         │
   │ 3    ┆ 8.0  ┆ c    ┆ null  ┆ null      │
   └──────┴──────┴──────┴───────┴───────────┘
   ```
   I haven't checked your PR yet @mesejo  but if we are going that direction, 
we might as well consider column renaming (?)


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

Reply via email to