Package cc.twittertools.piggybank

Source Code of cc.twittertools.piggybank.GetLatitude

package cc.twittertools.piggybank;

import java.io.IOException;
import java.util.Iterator;

import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.Tuple;

// Sample usage: cc.twittertools.piggybank.GetLatitude($0#'geo'#'coordinates')
public class GetLatitude extends EvalFunc<String> {
  public String exec(Tuple input) throws IOException {
    DataBag bag = (DataBag) input.get(0);
    Iterator<Tuple> it = bag.iterator();
    if (!it.hasNext()) {
      return null;
    }
    Tuple tup = it.next();

    return (String) tup.get(0);
  }
}
TOP

Related Classes of cc.twittertools.piggybank.GetLatitude

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.