Skip to content

Failed to create JS UDF sometimes #68

@jovezhong

Description

@jovezhong

I failed to create a JS UDF with the native JDBC driver

CREATE OR REPLACE FUNCTION bug1(arg0 string) RETURNS string LANGUAGE JAVASCRIPT AS $$
function _whois(ip){
    switch(ip){
        case '1.2.3.4': return 'Someone @ ACME';
        default: return 'Unknown';
    }
}
function bug1(ips){
    for(let i=0;i<ips.length;i++) {
      ips[i]=_whois(ips[i]);
    }
    return ips;
}
$$;

Error:

DB::ExceptionDB::Exception: the JavaScript UDF bug1 is invalid. Detail error: Uncaught SyntaxError: Unexpected token ')'. Stack trace:

Image

But the same SQL can be run in web console

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions