mircoteam created DRILL-5078:
--------------------------------

             Summary: use Custom Functions errors
                 Key: DRILL-5078
                 URL: https://issues.apache.org/jira/browse/DRILL-5078
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
    Affects Versions: 1.8.0
         Environment: window 7
            Reporter: mircoteam
            Priority: Trivial


I define a function like change encoding from UTF8 to GBK。
when I put it classes and source code into 3rdparty, and use it in query sql 
like this :
"SELECT encode_translate(columns[0],'UTF-8','GBK') as aaa FROM 
dfs.`d:/drill_test.csv` LIMIT 20"
it return a error info:
Query Failed: An Error Occurred
org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: 
CompileException: Line 92, Column 42: Cannot determine simple type name 
"UnsupportedEncodingException" Fragment 0:0 [Error Id: 
599d0e39-f05a-4ecd-a539-b5338239d63b on XXX.XXXX.com:31010]。

this is resource code of evel :

public void eval() {
        // get the value and replace with
        String stringValue = 
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start,
 input.end, input.buffer);
        String fromEncodeValue = 
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.getStringFromVarCharHolder(fromEncode);
        String toEncodeValue = 
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.getStringFromVarCharHolder(toEncode);

        try {
            String toEncodeStringValue = new 
String(stringValue.getBytes(fromEncodeValue),toEncodeValue);
            out.buffer = buffer;
            out.start = 0;
            out.end = toEncodeStringValue.getBytes().length;
            buffer.setBytes(0, toEncodeStringValue.getBytes());
        } catch (UnsupportedEncodingException e) {

        }
    }

please help me,thank your.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to