Hi Amit,
I am able to run this test without any issue.
test("string translate with escape characters") {
val df = Seq(("ab\\\"ab", "")).toDF("a", "b")
checkAnswer(df.select(translate($"a", "\\\"", "\"")), Row("ab\"ab"))
checkAnswer(df.selectExpr("""translate(a, "\\\"", "\"")"""), Row("ab\"ab"))
df.createOrReplaceTempView("table")
checkAnswer(spark.sql("select translate(a,'\"','\"') from table
"), Row("ab\"ab"))
}
This is basically converting value ab\\\"ab with ab\"ab.
I need the exact query where you are facing the issue. Might help in debug more.
Dp point out if i am mistaken.
Thanks
On Sat, Oct 26, 2019 at 4:47 PM amit kumar singh
wrote:
> Hi Team,
>
>
> I am trying to use regexp_replace in spark sql it throwing error
>
> expected , but found Scalar
> in 'reader', line 9, column 45:
> ... select translate(payload, '"', '"') as payload
>
>
> i am trying to remove all character from \\\" with "
>