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

Issues when overloading Drill native functions with dynamic UDFs

    XMLWordPrintableJSON

Details

    Description

      I created jar file which overloads 3 DRILL native functions (LOG(VARCHAR-REQUIRED), CURRENT_DATE(VARCHAR-REQUIRED) and ABS(VARCHAR-REQUIRED,VARCHAR-REQUIRED)) and registered it as dynamic UDF.

      If I try to use my functions I will get errors:

      SELECT CURRENT_DATE('test') FROM (VALUES(1));
      

      Error: FUNCTION ERROR: CURRENT_DATE does not support operand types (CHAR)
      SQL Query null

      SELECT ABS('test','test') FROM (VALUES(1));
      

      Error: FUNCTION ERROR: ABS does not support operand types (CHAR,CHAR)
      SQL Query null

      SELECT LOG('test') FROM (VALUES(1));
      

      Error: SYSTEM ERROR: DrillRuntimeException: Failure while materializing expression in constant expression evaluator LOG('test'). Errors:
      Error in expression at index -1. Error: Missing function implementation: castTINYINT(VARCHAR-REQUIRED). Full expression: UNKNOWN EXPRESSION.

      But if I rerun all this queries after "DrillRuntimeException", they will run correctly. It seems that Drill have not updated the function signature before that error. Also if I add jar as usual UDF (copy jar to /drill_home/jars/3rdparty and restart drillbits), all queries will run correctly without errors.

      Attachments

        1. subquery_udf-1.0.jar
          3 kB
          Roman Kulyk
        2. subquery_udf-1.0-sources.jar
          2 kB
          Roman Kulyk
        3. test_overloading-1.0.jar
          5 kB
          Roman Kulyk
        4. test_overloading-1.0-sources.jar
          4 kB
          Roman Kulyk

        Issue Links

          Activity

            People

              arina Arina Ielchiieva
              RomanKulyk Roman Kulyk
              Paul Rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: