replace

a with every occurrence of b replaced by c, left to right; an empty b leaves a as it is.

ScalarDeterministic

Flags

Flag Value
Kind scalar
Nulls a null argument gives null
Deterministic yes
Order matters no
Decomposable no

Example

A pipeline from the language's tested corpus that uses replace, over the example tables.

Hint
from customers
derive {full = concat(name, "-", region ?? "none"), r = replace(name, "c", "C"), parts = split(name, "0"), mid = substring(name, start: 2, length: 2)}

In a plan:

JSON
{
  "args": [
    {
      "col": 1
    },
    {
      "lit": "c",
      "type": {
        "kind": "utf8"
      }
    },
    {
      "lit": "C",
      "type": {
        "kind": "utf8"
      }
    }
  ],
  "fn": "replace"
}