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

mask() UDF not retaining day and month field values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 2.1.0
    • UDF
    • None

    Description

      For date type parameters, mask() UDF replaces year/month/day field values with the values given in arguments to the UDF. Argument value -1 is treated as special, to specify that mask() should retain the value in the parameter. This allows to selectively mask only year/month/day fields.

      Specifying "-1" does not retain the values for day/month fields; however the year value is retained, as shown below.

      0: jdbc:hive2://localhost:10000> select id, join_date from employee where id < 4;
      +-----+-------------+--+
      | id  |  join_date  |
      +-----+-------------+--+
      | 1   | 2012-01-01  |
      | 2   | 2014-02-01  |
      | 3   | 2013-03-01  |
      +-----+-------------+--+
      3 rows selected (0.435 seconds)
      0: jdbc:hive2://localhost:10000> select id, mask(join_date, -1, -1, -1, -1,-1, -1,-1,-1) join_date from employee where id < 4;
      +-----+-------------+--+
      | id  |  join_date  |
      +-----+-------------+--+
      | 1   | 2012-01-01  |
      | 2   | 2014-01-01  |
      | 3   | 2013-01-01  |
      +-----+-------------+--+
      3 rows selected (0.344 seconds)
      

      Attachments

        1. HIVE-13859.patch
          6 kB
          Madhan Neethiraj

        Issue Links

          Activity

            People

              Unassigned Unassigned
              madhan Madhan Neethiraj
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: