datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

Proposal: Add similar to operator

Open ayushdg opened this issue 3 years ago • 3 comments

Is your feature request related to a problem or challenge? Please describe what you are trying to do. Add support for the SIMILAR TO operator like:

string SIMILAR TO pattern [ESCAPE escape-character]
string NOT SIMILAR TO pattern [ESCAPE escape-character]

(This section helps Arrow developers understand the context and why for this feature, in addition to the what)

Describe the solution you'd like Support this sql syntax where currently users would see a parser error Expected end of statement, found: SIMILAR

Describe alternatives you've considered There is some overlap between the LIKE operator and SIMILAR though the regex interpretation might be slightly different.

Additional context Syntax from the postgresql documentation: https://www.postgresql.org/docs/current/functions-matching.html. Came up while working on tests in the dask-sql project.

ayushdg avatar Aug 03 '22 00:08 ayushdg

Seems reasonable to me

alamb avatar Aug 03 '22 13:08 alamb

Nice feature for datafusion core. Do you have a plan to implement it? @ayushdg

liukun4515 avatar Aug 04 '22 02:08 liukun4515

I am planning on implementing this but also happy if anyone else wants to pick it up

andygrove avatar Aug 04 '22 21:08 andygrove

sqlparser support was added here: https://github.com/sqlparser-rs/sqlparser-rs/pull/569

I'll try and get a new release of that library out in a day or two

alamb avatar Aug 15 '22 21:08 alamb

This is now being tracked in https://github.com/apache/arrow-datafusion/issues/3099

andygrove avatar Sep 09 '22 02:09 andygrove