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

invalid result when CAST-ing to DATE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.2.1
    • None
    • 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

        Issue Links

          Activity

            People

              ashish-kumar-sharma Ashish Sharma
              hopperjim Jim Hopper
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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