Skip to content

there is something wrong using contains udf #12930

@zhuliquan

Description

@zhuliquan

Describe the bug

Here, I want to find whether a string contain a substring. I using contain udf. I run below case, I got error

> select contains(lower('$SE=@(('), '$se=@(');
Execution error: Regular expression did not compile: Syntax(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regex parse error:
    $se=@(
         ^
error: unclosed group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)
>

I'm confused about why regex compile process is needed in the contains UDF. The contains UDF should perform a simple string match rather than using regex_match, according to the documentation on contains and its name.

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions