Skip to content

Native replace() returns wrong result for empty-string search #3344

@andygrove

Description

@andygrove

Description

Comet's native replace() function returns incorrect results when the search string is empty.

Spark behavior: replace('hello', '', 'x') returns xhxexlxlxox (inserts replacement between every character and at boundaries).

Comet behavior: returns hello (no replacement).

How to Reproduce

SELECT replace('hello', '', 'x');

Expected: xhxexlxlxox
Actual (Comet): hello

Expected Behavior

Comet should match Spark's semantics for empty-string search in replace().

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions