[ 
https://issues.apache.org/jira/browse/FLINK-10216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Juho Autio updated FLINK-10216:
-------------------------------
    Description: 
Here's a naive implementation:
{code:java}
public class RegexpMatchFunction extends ScalarFunction {
    // NOTE! Flink calls eval() by reflection
    public boolean eval(String value, String pattern) {
        return value != null && pattern != null && value.matches(pattern);
    }
}
{code}
I wonder if there would be a way to optimize this to use 
{{Pattern.compile(value)}} and use the compiled Pattern for multiple calls 
(possibly different values, but same pattern).
h3. Naming

Should regex functions be prefixed with {{regexp_}} or {{regex_}}? See also: 
[https://github.com/apache/flink/pull/6448#issuecomment-415972833]

  was:
Here's a naive implementation:

{code:java}
public class RegexpMatchFunction extends ScalarFunction {
    // NOTE! Flink calls eval() by reflection
    public boolean eval(String value, String pattern) {
        return value != null && pattern != null && value.matches(pattern);
    }
}
{code}

I wonder if there would be a way to optimize this to use 
{{Pattern.compile(value)}} and use the compiled Pattern for multiple calls 
(possibly different values, but same pattern).


> Add REGEXP_MATCH in TableAPI and SQL
> ------------------------------------
>
>                 Key: FLINK-10216
>                 URL: https://issues.apache.org/jira/browse/FLINK-10216
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Juho Autio
>            Priority: Major
>
> Here's a naive implementation:
> {code:java}
> public class RegexpMatchFunction extends ScalarFunction {
>     // NOTE! Flink calls eval() by reflection
>     public boolean eval(String value, String pattern) {
>         return value != null && pattern != null && value.matches(pattern);
>     }
> }
> {code}
> I wonder if there would be a way to optimize this to use 
> {{Pattern.compile(value)}} and use the compiled Pattern for multiple calls 
> (possibly different values, but same pattern).
> h3. Naming
> Should regex functions be prefixed with {{regexp_}} or {{regex_}}? See also: 
> [https://github.com/apache/flink/pull/6448#issuecomment-415972833]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to