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

typeof() lies about types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 1.13.0
    • None
    • None
    • None

    Description

      Drill provides a typeof() function that returns the type of a column. But, it seems to make up types. Consider the following input file:

      {a: true}
      {a: false}
      {a: null}
      

      Consider the following two queries:

      SELECT a FROM `json/boolean.json`;
      +--------+
      |   a    |
      +--------+
      | true   |
      | false  |
      | null   |
      +--------+
      > SELECT typeof(a) FROM `json/boolean.json`;
      +---------+
      | EXPR$0  |
      +---------+
      | BIT     |
      | BIT     |
      | NULL    |
      +---------+
      

      Notice that the values are reported as BIT. But, I believe the actual type is UInt1 (the bit vector is, I believe, deprecated.) Then, the function reports NULL instead of the actual type for the null value.

      Since Drill has an isnull() function, there is no reason for typeof() to muddle the type.

      Attachments

        Issue Links

          Activity

            People

              Paul.Rogers Paul Rogers
              paul-rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: