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

invalid result when CAST-ing to DATE

    XMLWordPrintableJSON

    Details

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

      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

              • Assignee:
                Unassigned
                Reporter:
                hopperjim Jim Hopper
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: