apache / apache/datafusion

Incorrect type coercion for IS SIMILAR TO

Open
#20,342 1 comment 1 reaction 1 assignee Claimed by @neilconway View on GitHub
bug
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Describe the bug

```
-- works
SELECT CAST('hello' AS BYTEA) LIKE 'hello%';

-- fails ("Cannot infer common argument type for regex operation Binary ~ Utf8")
SELECT CAST('hello' AS BYTEA) SIMILAR TO 'hello%';

-- works
SELECT arrow_cast('hello', 'Dictionary(Int32, Utf8)') LIKE 'hello%';

-- fails ("Data type Dictionary(Int32, Utf8) not supported for regex_match_dyn")
SELECT arrow_cast('hello', 'Dictionary(Int32, Utf8)') SIMILAR TO 'hello%';
```

I believe we'd want the same behavior for LIKE and IS SIMILAR TO. Per discussion in #20306

### To Reproduce

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.