Based on Snowflake product manager demo here at youtube -- https://www.youtube.com/watch?v=F5DWBdhFQF4
I created a java based function, compiled to jar, uploaded to stage and attempted to create function but it keep giving sql compilation error.
It looks like Snowflake now support Java function (beyond java script and SQL functions) but I unable to make it to work still.
I am on business critical snowflake edition.
--Function
create or replace function calc(int x, int y, char op)
returns int
language java
import @stage_java/SnowflakeFunctions-1.0-SNAPSHOT.jar
classpath='Calculate';
---Error
[42000][1003] SQL compilation error: syntax error line 4 at position 7 unexpected '@stage_java/SnowflakeFunctions-1.0-SNAPSHOT.jar'.
--Java Code
public class Calculate {
public static int compute(int x, int y, char op) {
int result = 0;
switch (op) {
case '+':
result = x + y;
break;
case '-':
result = x - y;
break;
case '/':
result = x / y;
break;
case '*':
result = x * y;
break;
}
return result;
}
}