Skip to content

Escape characters are not handled correctly in regular expressions while convert Hive SQL to Trino SQL #305

@zhuyaogai

Description

@zhuyaogai

Coral version: 2.0.86
SQL: select '2022-01-01' rlike '^\\d{4}-\\d{2}-\\d{2}$|^\\d{4}-\\d{2}$', return true in hive
However coral's translation result is SELECT "REGEXP_LIKE"('2022-01-01', '^\\d{4}-\\d{2}-\\d{2}$|^\\d{4}-\\d{2}$') FROM (VALUES (0)) AS "t" ("ZERO"), return false in trino, but we know the expected translation result is SELECT "REGEXP_LIKE"('2022-01-01', '^\d{4}-\d{2}-\d{2}$|^\d{4}-\d{2}$') FROM (VALUES (0)) AS "t" ("ZERO") (the double backslash should be translate to single backslash).

Is i using it wrong or there is a BUG ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions