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

"Incompatable field schema" with MIN(datetime_field) and explicit output type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.15.0
    • None
    • None
    • None

    Description

      Example:

      grunt> data = LOAD 'file.csv' USING PigStorage(',') AS (f1:chararray,f2:datetime);
      grunt> earliest_datum = FOREACH (GROUP data ALL) GENERATE MIN(data.f2);
      grunt> earliest_datum = FOREACH (GROUP data ALL) GENERATE MIN(data.f2) AS earliest;
      grunt> describe earliest_datum;
      earliest_datum: {earliest: datetime}
      grunt> earliest_datum = FOREACH (GROUP data ALL) GENERATE MIN(data.f2) AS earliest:datetime;
      2015-11-03 23:20:00,422 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1031: Incompatable field schema: declared is "earliest:datetime", infered is ":double"
      grunt> earliest_datum = FOREACH (GROUP data ALL) GENERATE MIN(data.f2) AS earliest:double;
      2015-11-03 23:20:07,454 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1031: Incompatable field schema: declared is "earliest:double", infered is ":datetime"
      

      The example is contrived, but applying MIN to other field types in the same fashion seems to behave as expected.

      Also affects MAX.

      Attachments

        Activity

          People

            Unassigned Unassigned
            nsmith Nathan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: