code: public static Expression arrayReplace(Expression expression, Expression value1, Expression value2, long n) {
          return x("ARRAY_REPLACE(" + expression.toString() + ", " + value1 + ", " + value2 + ", " + n + ")");
      }
docs: Returned expression results in new array with at most n occurrences of value1 replaced with value2.