Jefffrey commented on issue #22253:
URL: https://github.com/apache/datafusion/issues/22253#issuecomment-4533510742

   Even though we have some discussion on what we should actually try to align 
with postgres, see:
   
   - #22266
   
   I think it makes sense to implement this fix; postgres + duckdb + spark all 
have the same behaviour it seems of returning the original untouched:
   
   duckdb:
   
   ```sql
   memory D SELECT replace('abc', '', 'x');
   ┌───────────────────────────┐
   │ "replace"('abc', '', 'x') │
   │          varchar          │
   ├───────────────────────────┤
   │ abc                       │
   └───────────────────────────┘
   ```
   
   spark:
   
   ```python
   >>> spark.sql("select replace('abc', '', 'x')").show()
   +-----------------+
   |replace(abc, , x)|
   +-----------------+
   |              abc|
   +-----------------+
   ```
   
   I believe the only reason datafusion has this specific behaviour is that in 
the past it used 
[`str::replace`](https://doc.rust-lang.org/std/primitive.str.html#method.replace)
 from the rust stdlib which has this behaviour


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