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

CONVERT_TO_JSON function is failed while using non-existence field as a parameter.

    Details

      Description

      Using of non-existence field as parameter (or field with null values across a whole batch) of CONVERT_TO_JSON function leads to failure.

      simple.json

      {"id": 0}
      
      0: jdbc:drill:zk=local> select `id`, convert_to(`complex_field`, 'JSON') from dfs.`/tmp/simple.json`;
      Error: SYSTEM ERROR: UnsupportedOperationException: Unable to get holder type for minor type [LATE] and mode [OPTIONAL]
      
      Fragment 0:0
      
      [Error Id: a13a1ed0-f8fe-4d4a-ba35-ab17c3a2f171 on vitalii-pc:31010] (state=,code=0)
      

      The root cause of the issue and fix:
      If there isn't a particular vector for the field, "NullExpression" is created as an argument for the Drill function. That argument can be replaced later in "ExpressionTreeMaterializer.visitFunctionCall()" with "TypedNullConstant" logical expression, but LATE type shouldn't be used for this case, the data type of the field is still unknown.

      Note: the issue is reproduced not only for json (for example mongo or mapr-db json tables have the same issue)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vitalii Vitalii Diravka
                Reporter:
                vitalii Vitalii Diravka
                Reviewer:
                Arina Ielchiieva
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: