findepi commented on issue #12635:
URL: https://github.com/apache/datafusion/issues/12635#issuecomment-2650048313

   Going back to this topic. Not much happened on the Simple Functions front, 
but a lot happened in the world. New type system changes (Logical types can be 
found in type signatures https://github.com/apache/datafusion/pull/13372; 
preliminary steps towards extension types 
https://github.com/apache/datafusion/issues/14247).  We internally implemented 
quite a few functions and it allowed me to experience first-hand how important 
it is to make function authoring easier.
   
   Here is a design doc for what I would love to implement
   - 
https://docs.google.com/document/d/1JyfbYfpmjvd3N3LEVAN7tX1D9ze6N98yGx3g4po_WoQ
   
   It's open to comment by anyone.
   Your comments are more than welcome.
   
   ### Teaser
   
   Wouldn't it be cool to be able to implement a function like this?
   The engine should be able to automatically handle the common constant 
pattern case, as well as other situations.
   
   ```rust
   // SQL regexp_like(text, pattern, flags) -> bool
   #[vectorize]
   fn regexp_like(
       #[arg(2)] pattern: &str,
       #[arg(3)] flags: &str,
   ) -> Result<impl FnMut(#[arg(1)] &str) -> bool> {
       let regex = Regex::new(format!("(?{flags})^({pattern})$").as_str())?;
       Ok(move |text: &str| regex.is_match(text))
   }
   ```
   
   All the regexp and many date/time, and many other functions would greatly 
benefit if we can pull this up.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to