Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5078

use Custom Functions errors

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Not A Bug
    • 1.8.0
    • None
    • Functions - Drill
    • None
    • window 7

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            zhenTan mircoteam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment