Re: Missing string replace function

2022-10-02 Thread russell . spitzer
Ah for that I think it makes sense to add in a function but it probably should not be an alias for regex replace since that has very different semantics for certain string argumentsSent from my iPhoneOn Oct 2, 2022, at 1:31 PM, Khalid Mammadov wrote:Thanks Russell for checking this out!This is a

Re: Missing string replace function

2022-10-02 Thread Khalid Mammadov
Thanks Russell for checking this out! This is a good example of a *replace* which is available in the Sapk SQL but not in the PySpark API nor in Scala API unfortunately. Another alternative to this is mentioned regexp_replace, but as a developer looking for *replace* function we tend to ignore reg

Re: Missing string replace function

2022-10-02 Thread Russell Spitzer
Quick test on on 3.2 confirms everything should be working as expected scala> spark.createDataset(Seq(("foo", "bar"))) res0: org.apache.spark.sql.Dataset[(String, String)] = [_1: string, _2: string] scala> spark.createDataset(Seq(("foo", "bar"))).createTempView("temp") scala> spark.sql("SELECT r

Re: Missing string replace function

2022-10-02 Thread Russell Spitzer
https://spark.apache.org/docs/3.3.0/api/sql/index.html#replace This was added in Spark 2.3.0 as far as I can tell. https://github.com/apache/spark/pull/18047 > On Oct 2, 2022, at 11:1

Missing string replace function

2022-10-02 Thread Khalid Mammadov
Hi, As you know there's no string "replace" function inside pyspark.sql.functions for PySpark nor in org.apache.sql.functions for Scala/Java and was wondering why is that so? And I know there's regexp_replace instead and na.replace or SQL with expr. I think it's one of the fundamental functions i