Package com.facebook.hiveio.record

Examples of com.facebook.hiveio.record.HiveWritableRecord


   * @return hive record
   */
  public static HiveWritableRecord mapToHiveRecord(Configuration conf, MapWritable value) {
    try {
      HiveTableSchema schema = HiveTableSchemas.lookup(conf, getHiveTableName());
      HiveWritableRecord record = HiveRecordFactory.newWritableRecord(schema);
      for (Map.Entry<Writable, Writable> entry : value.entrySet()) {
        IntWritable intKey = (IntWritable) entry.getKey();
        LongWritable longValue = (LongWritable) entry.getValue();
        record.set(intKey.get(), longValue.get());
      }
      return record;
    } catch (IOException e) {
      throw new IllegalStateException(e);
    }
View Full Code Here


  private void writeData(HiveOutputDescription outputDesc, HiveTableSchema schema)
      throws TException, IOException, InterruptedException
  {
    List<HiveWritableRecord> writeRecords = Lists.newArrayList();

    HiveWritableRecord r1 = HiveRecordFactory.newWritableRecord(schema);
    writeRecords.add(r1);
    r1.set(0, 1);
    r1.set(1, 1.1);

    HiveWritableRecord r2 = HiveRecordFactory.newWritableRecord(schema);
    writeRecords.add(r2);
    r2.set(0, 2);
    r2.set(1, 2.2);

    HiveOutput.writeTable(outputDesc, writeRecords);
  }
View Full Code Here

      throw new IOException(e);
    }
  }

  public static HiveWritableRecord mapToHiveRecord(MapWritable value) {
    HiveWritableRecord record = HiveRecordFactory.newWritableRecord(HiveTools.NUM_COLUMNS);
    for (Map.Entry<Writable, Writable> entry : value.entrySet()) {
      IntWritable intKey = (IntWritable) entry.getKey();
      LongWritable longValue = (LongWritable) entry.getValue();
      record.set(intKey.get(), longValue.get());
    }
    return record;
  }
View Full Code Here

   * @param value data
   * @return hive record
   */
  public static HiveWritableRecord mapToHiveRecord(Configuration conf, MapWritable value) {
    HiveTableSchema schema = HiveTableSchemas.lookup(conf, getHiveTableName());
    HiveWritableRecord record = HiveRecordFactory.newWritableRecord(schema);
    for (Map.Entry<Writable, Writable> entry : value.entrySet()) {
      IntWritable intKey = (IntWritable) entry.getKey();
      LongWritable longValue = (LongWritable) entry.getValue();
      record.set(intKey.get(), longValue.get());
    }
    return record;
  }
View Full Code Here

TOP

Related Classes of com.facebook.hiveio.record.HiveWritableRecord

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.