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

    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Paul.Rogers Paul Rogers
            paul-rogers Paul Rogers

            Dates

              Created:
              Updated:

              Slack

                Issue deployment