Package org.apache.hcatalog.data

Examples of org.apache.hcatalog.data.DefaultHCatRecord


   
    public static class Map extends Mapper<LongWritable, Text, NullWritable, DefaultHCatRecord>{

      public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
          String[] cols = value.toString().split(",");
          DefaultHCatRecord record = new DefaultHCatRecord(3);
          record.set(0,Integer.parseInt(cols[0]));
          record.set(1,cols[1]);
          record.set(2,cols[2]);
          context.write(NullWritable.get(), record);
      }
View Full Code Here


      HCatRecord r;

      try {

        r = new LazyHCatRecord(serde.deserialize(currentValue),serde.getObjectInspector());
        DefaultHCatRecord dr = new DefaultHCatRecord(outputSchema.size());
        int i = 0;
        for (String fieldName : outputSchema.getFieldNames()){
          Integer dataPosn = null;
          if ((dataPosn = dataSchema.getPosition(fieldName)) != null){
            dr.set(i, r.get(fieldName,dataSchema));
          } else {
            dr.set(i, valuesNotInDataCols.get(fieldName));
          }
          i++;
        }
       
        return dr;
View Full Code Here

    int i = 0;
    for(HCatFieldSchema fSchema : computedSchema.getFields()){
      outgoing.add(getJavaObj(tuple.get(i++), fSchema));
    }
    try {
      writer.write(null, new DefaultHCatRecord(outgoing));
    } catch (InterruptedException e) {
      throw new BackendException("Error while writing tuple: "+tuple, PigHCatUtil.PIG_EXCEPTION_CODE, e);
    }
  }
View Full Code Here

            age = value.get(1)==null?null:(Integer)value.get(1);
            gpa = value.get(2)==null?null:(Double)value.get(2);

            if (gpa != null) gpa = Math.floor(gpa) + 0.1;
           
            HCatRecord record = new DefaultHCatRecord(5);
            record.set(0, name);
            record.set(1, age);
            record.set(2, gpa);
           
            context.write(null, record);

        }
View Full Code Here

          Iterator<IntWritable> iter = values.iterator();
          while (iter.hasNext()) {
              sum++;
              iter.next();
          }
          HCatRecord record = new DefaultHCatRecord(2);
          record.set(0, key.get());
          record.set(1, sum);
         
          context.write(null, record);
        }
View Full Code Here

                throws IOException, InterruptedException {
            String name = (String)value.get(0);
            int age = (Integer)value.get(1);
            String ds = (String)value.get(3);
           
            HCatRecord record = (filter == null ? new DefaultHCatRecord(3) : new DefaultHCatRecord(2));
            record.set(0, name);
            record.set(1, age);
            if (filter == null) record.set(2, ds);
           
            context.write(null, record);
View Full Code Here

        intnum100 = (((Integer) value.get(3)));
        intnum = ((Integer) value.get(4));
        longnum = ((Long) value.get(5));
        floatnum = ((Float) value.get(6));
        doublenum = ((Double) value.get(7));
        HCatRecord output = new DefaultHCatRecord(8);
        output.set(0, intnum1000 + 10);
        if(isnoPartPig)
        {
            output.set(1, ((int)(id + 10)));
        } else {
            output.set(1, ((short)(id + 10)));
        }
        if(isnoPartPig) {
            output.set(2(int)(intnum5 + 10));
        } else {
            output.set(2, (byte) (intnum5 + 10));
        }
       
        output.set(3, intnum100 + 10);
        output.set(4, intnum + 10);
        output.set(5, (long) (longnum + 10));
        output.set(6, (float) (floatnum + 10));
        output.set(7, (double) (doublenum + 10));
        for(int i = 0; i < 8; i++) {
            System.err.println("XXX: class:" + output.get(i).getClass());
        }
        context.write(new IntWritable(0), output);

    }
View Full Code Here

            b = (Long)value.get(3);
            f = (Float)value.get(4);
            d = (Double)value.get(5);
            s = (String)value.get(6);
           
            HCatRecord record = new DefaultHCatRecord(7);
            record.set(0, t);
            record.set(1, si);
            record.set(2, i);
            record.set(3, b);
            record.set(4, f);
            record.set(5, d);
            record.set(6, s);
           
            context.write(null, record);

        }
View Full Code Here

      String[] fields = curLine.split("\t");
      List<Object> data = new ArrayList<Object>(3);
      data.add(fields[0]);
      data.add(Integer.parseInt(fields[1]));
      data.add(Double.parseDouble(fields[2]));
      return new DefaultHCatRecord(data);
    }
View Full Code Here

                throws IOException, InterruptedException {
            s = value.get(0)==null?null:(String)value.get(0);
            i = value.get(1)==null?null:(Integer)value.get(1);
            d = value.get(2)==null?null:(Double)value.get(2);
           
            HCatRecord record = new DefaultHCatRecord(5);
            record.set(0, s);
            record.set(1, i);
            record.set(2, d);
           
            context.write(null, record);

        }
View Full Code Here

TOP

Related Classes of org.apache.hcatalog.data.DefaultHCatRecord

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.