Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-4244

Side effect of UnixToISO()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.11
    • None
    • piggybank
    • None

    Description

      To reproduce the bug, local timezone should not be set to UTC.

      Script below produces datetime strings and hour numbers in local timezone:

      in = load 'in' as (ts: long);
      out = foreach in generate ToDate(ts), GetHour(ToDate(ts));
      dump out;
      

      (For input 0 result is (1970-01-01T03:00:00.000+03:00,3) on my machine.)

      If UnixToISO() is called nearby, builtin ToDate() changes output, producing result in UTC timezone:

      register piggybank.jar;
      DEFINE UnixToISO org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO();
      
      in = load 'in' as (ts: long);
      out = foreach in generate UnixToISO(ts), ToDate(ts), GetHour(ToDate(ts));
      dump out;
      

      (For input 0 result is (1970-01-01T00:00:00.000Z,1970-01-01T00:00:00.000Z,0) on my machine.)

      Attachments

        Activity

          People

            Unassigned Unassigned
            fedyakov Pavel Fedyakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: