Hi all. I just wonder is there any example on how ...
# troubleshooting
j
Hi all. I just wonder is there any example on how to create jar to use in Flink SQL Client.
Copy code
./bin/sql-client.sh --help        
-j,--jar <JAR file>                   A JAR file to be imported into the
                                    session. The file might contain
                                    user-defined classes needed for the
                                    execution of statements such as
                                    functions, table sources, or sinks.
                                    Can be used multiple times.
For example myudf.jar
Copy code
import org.apache.flink.table.api.*;
import org.apache.flink.table.functions.ScalarFunction;
import static org.apache.flink.table.api.Expressions.*;

// define function logic
public static class SubstringFunction extends ScalarFunction {
  public String eval(String s, Integer begin, Integer end) {
    return s.substring(begin, end);
  }
}

TableEnvironment env = TableEnvironment.create(...);

// register function
env.createTemporarySystemFunction("SubstringFunction", SubstringFunction.class);
r
You could check if the jar you need is available on Maven. Download and link it using the steps in Dependency Management.
j
What about UDF i want to create myself? I just wonder how to write java code to be compatible with Flink SQL client