com.twitter.elephantbird.pig.piggybank.JsonStringToMap Maven / Gradle / Ivy
package com.twitter.elephantbird.pig.piggybank;
import java.io.IOException;
import java.util.Map;
import org.apache.pig.EvalFunc;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.util.Utils;
import org.apache.pig.parser.ParserException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Maps;
import com.twitter.elephantbird.pig.util.PigCounterHelper;
/**
* Transforms a Json string into a Pig map whose value type is chararray. Only goes one level deep;
* All input map values are converted to strings via {@link Object#toString()}.
*/
public class JsonStringToMap extends EvalFunc