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

SYSTEM ERROR: CompileException: Line 87, Column 32: Expression "right.end" is not an rvalue

    XMLWordPrintableJSON

Details

    Description

      Reproduce by:
      > select to_date('2019-01-12', `expr$0`) from (values ('yyyy-mm-dd'));
      Error: SYSTEM ERROR: CompileException: Line 87, Column 32: Expression "right.end" is not an rvalue
       

      I am deeply confused by the assumption of the UDF framework. Take simple functions for example, it has 'setup()' and 'eval()' methods. It seems that 'setup()' is meant to handle some immutable input and state across the entire table processing, and 'eval()' to handle state/output related to each row.

      However there are several problems:

      1. The codegen would only generate argument reference for 'setup()' if the argument is a Constant (a runtime check). However if this is the case, then the check should not be a runtime check, it should be an annotation such as @Param(constant=true). Otherwise when users pass in a column reference instead of a constant, the above error occurs.
      2. a NULL_IF_NULL simple functions could leave the null handling to the framework, so that it can focus on the situation where arguments are non-null. However the null handling code covers only 'eval()' function, it does not cover the 'setup()' function. Which might lead to problem when the argument is a constant OPTIONAL type (though it seems odd, it's possible when using a CASE WHEN expression)
      3. UDF with Nullable parameters should be able to accept arguments of REQUIRED type. However current code of function resolving does not support such cases.

      Could someone please share more information about the UDF framework and the future development direction of it? Such as:

      1. What's the purpose of the 'setup()' method, and should it refer to non-constant parameters?
      2. Should a REQUIRED argument be accepted as a OPTIONAL parameter?

      Thank you very much.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jingwang Zhang Jingwang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: