Package org.apache.pig.data

Examples of org.apache.pig.data.Datum


  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(ulp(input));
  }
 
  protected double ulp(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here


            if (evalPipe == null) {
                setupReducePipe(properties);
            }

            DataBag[] bags = new DataBag[inputCount];
            Datum groupName = key.getField(0);
            Tuple t = new Tuple(1 + inputCount);
            t.setField(0, groupName);
            for (int i = 1; i < 1 + inputCount; i++) {
                bags[i - 1] = BagFactory.getInstance().newDefaultBag();
                t.setField(i, bags[i - 1]);
View Full Code Here

                }
            }

            index = PigInputFormat.getActiveSplit().getIndex();

            Datum groupName = key.getField(0);
            finalout.group = key;
            finalout.index = index;
           
            Tuple t = new Tuple(1 + inputCount);
            t.setField(0, groupName);
View Full Code Here

  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(expm1(input));
  }
 
  protected double expm1(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here

  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(toDegree(input));
  }
 
  protected double toDegree(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here

  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(log(input));
  }
 
  protected double log(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here

    }

    @Override
    public boolean eval(Datum input) {
       
        Datum d1 = left.simpleEval(input);
        Datum d2 = right.simpleEval(input);
       
        if (!(d1 instanceof DataAtom) || !(d2 instanceof DataAtom)){
            throw new RuntimeException("Builtin functions cannot be used to compare non-atomic values. Use a filter function instead.");
        }
       
View Full Code Here

  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(cos(input));
  }
 
  protected double cos(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here

       
        UserComparator(Comparator<Tuple> nested) {
            this.nested = nested;
        }
        public int compare(Tuple t1, Tuple t2) {
            Datum d1 = simpleEval(t1);
            Datum d2 = simpleEval(t2);
            if (d1 instanceof Tuple) {
                return nested.compare((Tuple)d1, (Tuple)d2);
            } else {
                return nested.compare(new Tuple(d1), new Tuple(d2));
            }
View Full Code Here

  public void exec(Tuple input, DataAtom output) throws IOException {
    output.setValue(ceil(input));
  }
 
  protected double ceil(Tuple input) throws IOException{
    Datum temp = input.getField(0);
    double retVal;
    if(!(temp instanceof DataAtom)){
      throw new IOException("invalid input format. ");
    }
    else{
View Full Code Here

TOP

Related Classes of org.apache.pig.data.Datum

Copyright © 2018 www.massapicom. 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.