Package org.apache.hcatalog.data

Examples of org.apache.hcatalog.data.HCatRecord


    }
    assertTrue(sawException);
  }

  public void testSize() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    assertEquals(4, r.size());
  }
View Full Code Here


    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    assertEquals(4, r.size());
  }

  public void testReadFields() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    boolean sawException = false;
    try {
      r.readFields(null);
    } catch (UnsupportedOperationException uoe) {
      sawException = true;
    }
    assertTrue(sawException);
  }
View Full Code Here

    }
    assertTrue(sawException);
  }

  public void testWrite() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    boolean sawException = false;
    try {
      r.write(null);
    } catch (UnsupportedOperationException uoe) {
      sawException = true;
    }
    assertTrue(sawException);
  }
View Full Code Here

    }
    assertTrue(sawException);
  }

  public void testSetWithName() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    boolean sawException = false;
    try {
      r.set("fred", null, "bob");
    } catch (UnsupportedOperationException uoe) {
      sawException = true;
    }
    assertTrue(sawException);
  }
View Full Code Here

    }
    assertTrue(sawException);
  }

  public void testRemove() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    boolean sawException = false;
    try {
      r.remove(0);
    } catch (UnsupportedOperationException uoe) {
      sawException = true;
    }
    assertTrue(sawException);
  }
View Full Code Here

    }
    assertTrue(sawException);
  }

  public void testCopy() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
    boolean sawException = false;
    try {
      r.copy(null);
    } catch (UnsupportedOperationException uoe) {
      sawException = true;
    }
    assertTrue(sawException);
  }
View Full Code Here

    }
    assertTrue(sawException);
  }

  public void testGetWritable() throws Exception {
    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector()).getWritable();
    assertEquals(INT_CONST, ((Integer)r.get(0)).intValue());
    assertEquals(LONG_CONST, ((Long)r.get(1)).longValue());
    assertEquals(DOUBLE_CONST, ((Double)r.get(2)).doubleValue());
    assertEquals(STRING_CONST, (String)r.get(3));
    assertEquals("org.apache.hcatalog.data.DefaultHCatRecord", r.getClass().getName());
  }
View Full Code Here

    try {
      committer = outFormat.getOutputCommitter(cntxt);
      committer.setupTask(cntxt);
      writer   = outFormat.getRecordWriter(cntxt);
      while(recordItr.hasNext()){
        HCatRecord rec = recordItr.next();
        writer.write(null, rec);
      }
      writer.close(cntxt);
      if(committer.needsTaskCommit(cntxt)){
        committer.commitTask(cntxt);       
View Full Code Here

    @Override
    public void map(LongWritable key, Text value, Context context
    ) throws IOException, InterruptedException {
      {
        try {
          HCatRecord rec = writeRecords.get(writeCount);
          context.write(null, rec);
          writeCount++;

        }catch(Exception e) {
View Full Code Here

    public static class MapHCatWrite extends Mapper<LongWritable, Text, BytesWritable, HCatRecord> {
        @Override
        public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
            OutputJobInfo jobInfo = (OutputJobInfo)HCatUtil.deserialize(context.getConfiguration().get(HCatConstants.HCAT_KEY_OUTPUT_INFO));
            HCatRecord record = new DefaultHCatRecord(3);
            HCatSchema schema = jobInfo.getOutputSchema();
            String vals[] = value.toString().split(",");
            record.setInteger("key",schema,Integer.parseInt(vals[0]));
            for(int i=1;i<vals.length;i++) {
                String pair[] = vals[i].split(":");
                record.set(pair[0],schema,pair[1]);
            }
            context.write(null,record);
        }
View Full Code Here

TOP

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

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.