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

JsonLoader strange results on incorrect type in json data

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.11.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      java version "1.7.0_21"
      Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

      Mac OS X 10.8.4

      Description

      test.pig
      test = load 'data1.json' using JsonLoader('
          val1: int,
          val2: int,
          val3: int
      ');
      dump test;
      
      data1.json
      {"val1": 1, "val2": 2, "val3": 3}
      {"val1": 1, "val2": "2", "val3": 3}
      {"val1": 1, "val2": 2, "val3": "3"}
      {"val1": 1, "val2": "2", "val3": "3"}
      
      result1
      (1,2,3)
      (1,1,3)
      (1,2,2)
      (1,1,1)
      
      data2.json
      {"val1": "1", "val2": 2, "val3": 3}
      
      result2
      org.codehaus.jackson.JsonParseException: Current token (VALUE_STRING) not numeric, can not use numeric value accessors
       at [Source: java.io.ByteArrayInputStream@4ec2c12c; line: 1, column: 11]
      	at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:943)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              xeenon Pavel N. Savenkov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: