Examples of BytesWritable


Examples of org.apache.hadoop.io.BytesWritable

        File f = new File(this.imageDir, path);
        if (!f.exists()) {
            return;
        }
        byte[] imageData = FileUtils.readFileToByteArray(f);
        imageOut.append(new SequenceFileKey(recordType, id, path, title), new BytesWritable(imageData));
    }
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

    FileSystem fileSys = FileSystem.get(conf);
    SequenceFile.Writer writer =
      SequenceFile.createWriter(fileSys, conf, name,
                                BytesWritable.class, BytesWritable.class,
                                CompressionType.NONE);
    writer.append(new BytesWritable(), new BytesWritable());
    writer.close();
    fileSys.setReplication(name, replication);
    DFSTestUtil.waitReplication(fileSys, name, replication);
  }
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

    ArrayWritable vector = new ArrayWritable(Text.class, vectorValues);
    MapWritable map = new MapWritable();
    map.put(new Text("one"), new VIntWritable(1));
    map.put(new Text("two"), new VLongWritable(2));
    Writable[] writables = new Writable[] {
      new BytesWritable(new byte[] { 1, 2, 3, 4 }),
      new ByteWritable((byte) 123), new BooleanWritable(true),
      new VIntWritable(12345), new VLongWritable(123456789L),
      new FloatWritable((float) 1.2), new DoubleWritable(1.234),
      new Text("random string"),
      new ObjectWritable("test")
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

        }
        if (replyToken != null) {
          if (LOG.isDebugEnabled())
            LOG.debug("Will send token of size " + replyToken.length
                + " from saslServer.");
          doSaslReply(SaslStatus.SUCCESS, new BytesWritable(replyToken), null,
              null);
        }
        if (saslServer.isComplete()) {
          LOG.info("SASL server context established. Negotiated QoP is "
              + saslServer.getNegotiatedProperty(Sasl.QOP));
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

                value.tuple = new Tuple();

                for (int i = 0; i < results.getMetaData().getColumnCount(); i++) {
                    Object o = results.getObject(i + 1);
                    if (o instanceof byte[]) {
                        o = new BytesWritable((byte[]) o);
                    } else if (o instanceof BigInteger) {
                        o = ((BigInteger) o).longValue();
                    } else if (o instanceof BigDecimal) {
                        o = ((BigDecimal) o).doubleValue();
                    }
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

    Reader reader =
        new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
    long offset = 0;
    long rowCount = 0;
    BytesWritable key, value;
    for (int i = 0; i < numSplit; ++i, offset += splitSize) {
      Scanner scanner = reader.createScannerByByteRange(offset, splitSize);
      int count = 0;
      key = new BytesWritable();
      value = new BytesWritable();
      while (!scanner.atEnd()) {
        scanner.entry().get(key, value);
        ++count;
        scanner.advance();
      }
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

      if (i == numSplits-1) {
        endRec = totalRecords;
      }
      Scanner scanner = reader.createScannerByRecordNum(startRec, endRec);
      int count = 0;
      BytesWritable key = new BytesWritable();
      BytesWritable value = new BytesWritable();
      long x=startRec;
      while (!scanner.atEnd()) {
        assertEquals("Incorrect RecNum returned by scanner", scanner.getRecordNum(), x);
        scanner.entry().get(key, value);
        ++count;
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

      if (firstValidCG >= 0) {
        status.beginKey = colGroups[firstValidCG].getStatus().getBeginKey();
        status.endKey = colGroups[firstValidCG].getStatus().getEndKey();
        status.rows = colGroups[firstValidCG].getStatus().getRows();
      } else {
        status.beginKey = new BytesWritable(new byte[0]);
        status.endKey = status.beginKey;
        status.rows = 0;
      }
      status.size = 0;
      for (int nx = 0; nx < colGroups.length; nx++) {
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

            tuple.set(k, b + "_" + i + "" + k);
          } catch (ExecException e) {
            e.printStackTrace();
          }
        }
        inserters[i].insert(new BytesWritable(("key1" + i).getBytes()), tuple);
      }
    }
    for (int i = 0; i < numsInserters; i++) {
      inserters[i].close();
    }
    writer.close();

    /*
     * create 2nd basic table;
     */
    pathTable2 = new Path(pathWorking, "TestBasicTableUnion" + "2");
    System.out.println("pathTable2 =" + pathTable2);

    writer = new BasicTable.Writer(pathTable2, "a:string,b,d:string",
        "[a,b];[d]", conf);
    schema = writer.getSchema();
    tuple = TypesUtils.createTuple(schema);

    inserters = new TableInserter[numsInserters];
    for (int i = 0; i < numsInserters; i++) {
      inserters[i] = writer.getInserter("ins" + i, false);
    }

    for (int b = 0; b < numsBatch; b++) {
      for (int i = 0; i < numsInserters; i++) {
        TypesUtils.resetTuple(tuple);
        for (int k = 0; k < tuple.size(); ++k) {
          try {
            tuple.set(k, b + "_" + i + "" + k);
          } catch (ExecException e) {
            e.printStackTrace();
          }
        }
        inserters[i].insert(new BytesWritable(("key2" + i).getBytes()), tuple);
      }
    }
    for (int i = 0; i < numsInserters; i++) {
      inserters[i].close();
    }
View Full Code Here

Examples of org.apache.hadoop.io.BytesWritable

      output.collect(bytesKey, tupleRow);
    }

    @Override
    public void configure(JobConf job) {
      bytesKey = new BytesWritable();
      conf = job;
      sortKey = job.get("sortKey");
      try {
        Schema outSchema = BasicTableOutputFormat.getSchema(job);
        tupleRow = (ZebraTuple) TypesUtils.createTuple(outSchema);
View Full Code Here
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.