Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-17038

invalid result when CAST-ing to DATE

Log workAgile BoardRank to TopRank to BottomAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: CLI, Hive

      Description

      when casting incorrect date literals to DATE data type hive returns wrong values instead of NULL.

      SELECT CAST('2017-02-31' AS DATE);
      SELECT CAST('2017-04-31' AS DATE);
      
      

      Some examples below where it really can produce weird results:

      select *
        from (
      select cast('2017-07-01' as date) as dt
      ) as t
      where t.dt = '2017-06-31';
      
      select *
        from (
      select cast('2017-07-01' as date) as dt
      ) as t
      where t.dt = cast('2017-06-31' as date);
      
      

        Attachments

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

              Dates

              • Created:
                Updated:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 20m
              20m

                Issue deployment