@Override public void set(String fieldName, HCatSchema recordSchema, Object value) throws HCatException { set(recordSchema.getPosition(fieldName), value); }
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); } }
@Override public void set(String fieldName, HCatSchema recordSchema, Object value) throws HCatException { set(recordSchema.getPosition(fieldName), value); }
@Override public void set(String fieldName, HCatSchema recordSchema, Object value) throws HCatException { set(recordSchema.getPosition(fieldName), value); }
@Override public void set(String fieldName, HCatSchema recordSchema, Object value) throws HCatException { set(recordSchema.getPosition(fieldName), value); }
@Override public void set(String fieldName, HCatSchema recordSchema, Object value) throws HCatException { set(recordSchema.getPosition(fieldName), value); }
private List<HCatRecord> generateHCatRecords(int numRecords, HCatSchema hCatTblSchema, ColumnGenerator... extraCols) throws Exception { List<HCatRecord> records = new ArrayList<HCatRecord>(); List<HCatFieldSchema> hCatTblCols = hCatTblSchema.getFields(); int size = hCatTblCols.size(); for (int i = 0; i < numRecords; ++i) { DefaultHCatRecord record = new DefaultHCatRecord(size); record.set(hCatTblCols.get(0).getName(), hCatTblSchema, i); record.set(hCatTblCols.get(1).getName(), hCatTblSchema, "textfield" + i); int idx = 0; for (int j = 0; j < extraCols.length; ++j) { if (extraCols[j].getKeyType() == KeyType.STATIC_KEY) { continue; } record.set(hCatTblCols.get(idx + 2).getName(), hCatTblSchema, extraCols[j].getHCatValue(i)); ++idx; } records.add(record); } return records; }