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

typeOf drillTypeOf sqlTypeOf not work with generated tables

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.15.0
    • Fix Version/s: 1.16.0
    • Component/s: Functions - Drill
    • Labels:
      None

      Description

       

      *TypeOf functions works when request on files but doesn't work on "generated" data

      This works :

      SELECT typeof(md5), drillTypeOf(md5), sqlTypeOf(md5) FROM dfs.tmp.`mytable.csv` LIMIT 2;
      => (OK)
      +----------+----------+--------------------+
      |  EXPR$0  |  EXPR$1  |       EXPR$2       |
      +----------+----------+--------------------+
      | VARCHAR  | VARCHAR  | CHARACTER VARYING  |
      | VARCHAR  | VARCHAR  | CHARACTER VARYING  |
      +----------+----------+--------------------+

      But not :

       

       

      SELECT typeOf(a) FROM (SELECT CAST (5 as int) AS a) x;
      => (NOK)
      Error: SYSTEM ERROR: IllegalArgumentException: Can not set org.apache.drill.exec.vector.complex.reader.FieldReader field org.apache.drill.exec.expr.fn.impl.UnionFunctions$GetType.input to org.apache.drill.exec.expr.holders.IntHolder
      

      And in a surprising way the next query works :

      SELECT md5, typeof(t), drillTypeOf(t), sqlTypeOf(t) FROM ((SELECT 'foo' AS t ) union (SELECT 'far' AS t)) x;
      => (OK)
      +-------+----------+----------+--------------------+
      |  md5  |  EXPR$1  |  EXPR$2  |       EXPR$3       |
      +-------+----------+----------+--------------------+
      | foo   | VARCHAR  | VARCHAR  | CHARACTER VARYING  |
      | bar   | VARCHAR  | VARCHAR  | CHARACTER VARYING  |
      +-------+----------+----------+--------------------+

       

       

       

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                volodymyr Vova Vysotskyi
                Reporter:
                benj641 benj
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: