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

typeof() lies about types

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.13.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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

            • Assignee:
              Paul.Rogers Paul Rogers
              Reporter:
              paul-rogers Paul Rogers

              Dates

              • Created:
                Updated:

                Issue deployment