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

JsonLoader strange results on incorrect type in json data

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.11.1
    • None
    • None
    • None
    • 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

            Unassigned Unassigned
            xeenon Pavel N. Savenkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: