regexapache-calcite

How to use Apache calcite LIKE_REGEX


I would like to use LIKE_REGEX in Apache calcite SQL query and can not find any documentation or examples on how to use it. Can you please share examples or documentation around it's usage.


Solution

  • LIKE_REGEX was introduced in the SQL:2008 standard but as of version 1.17 Calcite does not currently support it. (If you look at Calcite's SQL reference, LIKE_REGEX appears in Calcite's list of reserved SQL keywords because Calcite automatically reserves keywords listed in the SQL standard.)

    If you would like to match regular expressions, use SIMILAR TO. For example, the query VALUES 'abcccd' similar to 'ab*c+d' returns TRUE.

    Calcite's implementation of SIMILAR TO has semantics similar to PostgreSQL's implementation.