We're using a timestamp (long) as the HWM, so the first attempt failed because Scala didn't like the long literal without an "L". I couldn't figure out a way to specify a long literal in the visual query editor. It didn't like literals like "123456789L", nor did it like 123456789.cast('long'). They both get the error "str is null". I eventually worked around this by just appending the "L" when doing the replace operation.