Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.ByteWritable$Comparator


        final Path file = new Path(new File("target/test/test-camel-byte").getAbsolutePath());
        Configuration conf = new Configuration();
        FileSystem fs1 = FileSystem.get(file.toUri(), conf);
        SequenceFile.Writer writer = createWriter(fs1, conf, file, NullWritable.class, ByteWritable.class);
        NullWritable keyWritable = NullWritable.get();
        ByteWritable valueWritable = new ByteWritable();
        byte value = 3;
        valueWritable.set(value);
        writer.append(keyWritable, valueWritable);
        writer.sync();
        writer.close();

        context.addRoutes(new RouteBuilder() {
View Full Code Here


        private static final int SIZE = 1;

        @Override
        public Writable create(Object value, TypeConverter typeConverter, Holder<Integer> size) {
            size.value = SIZE;
            ByteWritable writable = new ByteWritable();
            writable.set(typeConverter.convertTo(Byte.class, value));
            return writable;
        }
View Full Code Here

        private static final int SIZE = 1;

        @Override
        public Writable create(Object value, TypeConverter typeConverter, Holder<Integer> size) {
            size.value = SIZE;
            ByteWritable writable = new ByteWritable();
            writable.set(typeConverter.convertTo(Byte.class, value));
            return writable;
        }
View Full Code Here

        final Path file = new Path(new File("target/test/test-camel-byte").getAbsolutePath());
        Configuration conf = new Configuration();
        FileSystem fs1 = FileSystem.get(file.toUri(), conf);
        SequenceFile.Writer writer = createWriter(fs1, conf, file, NullWritable.class, ByteWritable.class);
        NullWritable keyWritable = NullWritable.get();
        ByteWritable valueWritable = new ByteWritable();
        byte value = 3;
        valueWritable.set(value);
        writer.append(keyWritable, valueWritable);
        writer.sync();
        writer.close();

        MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
View Full Code Here

        final Path file = new Path(new File("target/test/test-camel-byte").getAbsolutePath());
        Configuration conf = new Configuration();
        SequenceFile.Writer writer = createWriter(conf, file, NullWritable.class, ByteWritable.class);
        NullWritable keyWritable = NullWritable.get();
        ByteWritable valueWritable = new ByteWritable();
        byte value = 3;
        valueWritable.set(value);
        writer.append(keyWritable, valueWritable);
        writer.sync();
        writer.close();

        MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
View Full Code Here

        private static final int SIZE = 1;

        @Override
        public Writable create(Object value, TypeConverter typeConverter, Holder<Integer> size) {
            size.value = SIZE;
            ByteWritable writable = new ByteWritable();
            writable.set(typeConverter.convertTo(Byte.class, value));
            return writable;
        }
View Full Code Here

      return;
    }
    case BYTE:
    {
      ByteObjectInspector boi = (ByteObjectInspector) poi;
      ByteWritable r = (ByteWritable) elements[i];
      r.set(boi.get(o));
      return;
    }
    case SHORT:
    {
      ShortObjectInspector spoi = (ShortObjectInspector) poi;
      ShortWritable r = (ShortWritable) elements[i];
      r.set(spoi.get(o));
      return;
    }
    case INT:
    {
      IntObjectInspector ioi = (IntObjectInspector) poi;
      IntWritable r = (IntWritable) elements[i];
      r.set(ioi.get(o));
      return;
    }
    case LONG:
    {
      LongObjectInspector loi = (LongObjectInspector) poi;
      LongWritable r = (LongWritable) elements[i];
      r.set(loi.get(o));
      return;
    }
    case FLOAT:
    {
      FloatObjectInspector foi = (FloatObjectInspector) poi;
      FloatWritable r = (FloatWritable) elements[i];
      r.set(foi.get(o));
      return;
    }
    case DOUBLE:
    {
      DoubleObjectInspector doi = (DoubleObjectInspector) poi;
      DoubleWritable r = (DoubleWritable) elements[i];
      r.set(doi.get(o));
      return;
    }
    case STRING:
    {
      StringObjectInspector soi = (StringObjectInspector) poi;
View Full Code Here

    @Override
    public Object getPrimitiveWritableObject(Object o) {
        if(o == null) return null;
       
        if(o instanceof String) {
           return new ByteWritable(ParsePrimitiveUtils.parseByte((String)o));
        } else {
           return new ByteWritable((Byte) o);
        }
    }
View Full Code Here

    return reusableId;
  }

  @Override
  public ByteWritable getMappingTarget(HiveReadableRecord record) {
    ByteWritable reusableTarget = getReusableMappingTarget();
    reusableTarget.set(record.getByte(1));
    return reusableTarget;
  }
View Full Code Here

  }

  @Override
  public ByteWritable getMappingTarget(HiveReadableRecord record) {
    int target = record.getInt(1);
    ByteWritable reusableTarget = getReusableMappingTarget();
    int bVal = target % numWorkers;
    if ((bVal >>> 8) != 0) {
      throw new IllegalStateException("target % numWorkers overflows " +
          "byte range");
    }
    reusableTarget.set((byte) bVal);
    return reusableTarget;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.ByteWritable$Comparator

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.