List of usage examples for org.apache.hadoop.io ObjectWritable ObjectWritable
public ObjectWritable()
From source file:co.cask.cdap.etl.batch.mapreduce.TaggedWritable.java
License:Apache License
@Override public void setConf(Configuration conf) { this.conf = conf; recordWritable = new ObjectWritable(); // ObjectWritable does not set conf while reading fields recordWritable.setConf(conf);/*ww w . ja v a 2s. c o m*/ }
From source file:co.cask.cdap.hive.stream.StreamRecordReader.java
License:Apache License
@Override public ObjectWritable createValue() { // this method creates the value that is then passed into the next method, where it is set. return new ObjectWritable(); }
From source file:com.bah.culvert.constraints.Constraint.java
License:Apache License
/** * Read the constraint from the stream/* w ww . j a va2 s.c o m*/ * @param in to read the constraint from * @return specified {@link Constraint} * @throws IOException if the constraint could not be created or read */ public static Constraint readFromStream(DataInput in) throws IOException { ObjectWritable ow = new ObjectWritable(); Configuration conf = new Configuration(); ow.setConf(conf); ow.readFields(in); return (Constraint) ow.get(); }
From source file:com.bah.culvert.constraints.IndexRangeConstraint.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { range.readFields(in);/* w ww .j ava 2s.c om*/ ObjectWritable ow = new ObjectWritable(); Configuration conf = new Configuration(); ow.setConf(conf); ow.readFields(in); this.index = (Index) ow.get(); }
From source file:com.bah.culvert.constraints.join.IndexedJoin.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); ObjectWritable ow = new ObjectWritable(); Configuration conf = new Configuration(); ow.setConf(conf);/* w w w .j a va 2 s.c o m*/ ow.readFields(in); this.rightIndex = (Index) ow.get(); }
From source file:com.bah.culvert.constraints.Join.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { ObjectWritable ow = new ObjectWritable(); Configuration conf = new Configuration(); ow.setConf(conf);/*from w ww . j a v a 2 s .com*/ // read in left table ow.readFields(in); this.leftTable = (TableAdapter) ow.get(); // read in left constraint ow.readFields(in); this.left = (Constraint) ow.get(); // read in left column this.leftColumn = new CColumn(); this.leftColumn.readFields(in); // read in right table this.rightTable = Text.readString(in); ow.readFields(in); this.database = (DatabaseAdapter) ow.get(); }
From source file:com.bah.culvert.constraints.RetrieveColumns.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.columns = new CColumn[in.readInt()]; for (int i = 0; i < this.columns.length; i++) { CColumn column = new CColumn(); column.readFields(in);// ww w . j av a2 s.c om this.columns[i] = column; } this.subConstraint = Constraint.readFromStream(in); ObjectWritable ow = new ObjectWritable(); Configuration conf = new Configuration(); ow.setConf(conf); ow.readFields(in); this.table = (TableAdapter) ow.get(); }
From source file:org.apache.hama.bsp.message.queue.SpillingQueue.java
License:Apache License
@SuppressWarnings("unchecked") @Override// ww w . j a v a 2 s . c om public void init(Configuration conf, TaskAttemptID arg1) { bufferCount = conf.getInt(SPILLBUFFER_COUNT, 3); bufferSize = conf.getInt(SPILLBUFFER_SIZE, Constants.BUFFER_DEFAULT_SIZE); direct = conf.getBoolean(SPILLBUFFER_DIRECT, true); threshold = conf.getInt(SPILLBUFFER_THRESHOLD, Constants.BUFFER_DEFAULT_SIZE); fileName = conf.get(SPILLBUFFER_FILENAME, System.getProperty("java.io.tmpdir") + File.separatorChar + new BigInteger(128, new SecureRandom()).toString(32)); messageClass = (Class<M>) conf.getClass(Constants.MESSAGE_CLASS, null); objectWritableMode = messageClass == null; SpilledDataProcessor processor; try { processor = new CombineSpilledDataProcessor<M>(fileName); processor.init(conf); } catch (FileNotFoundException e) { LOG.error("Error initializing spilled data stream.", e); throw new RuntimeException(e); } spillOutputBuffer = new SpillingDataOutputBuffer(bufferCount, bufferSize, threshold, direct, processor); objectWritable = new ObjectWritable(); objectWritable.setConf(conf); this.conf = conf; }
From source file:org.apache.nutch.scoring.webgraph.ScoreUpdater.java
License:Apache License
/** * Changes input into ObjectWritables.//from w w w. ja va 2 s. c o m */ public void map(Text key, Writable value, OutputCollector<Text, ObjectWritable> output, Reporter reporter) throws IOException { ObjectWritable objWrite = new ObjectWritable(); objWrite.set(value); output.collect(key, objWrite); }
From source file:org.apache.oozie.action.hadoop.OozieLauncherInputFormat.java
License:Apache License
public RecordReader<Object, Object> getRecordReader(InputSplit arg0, JobConf arg1, Reporter arg2) throws IOException { return new RecordReader<Object, Object>() { @Override//from w w w . j av a 2s. co m public void close() throws IOException { } @Override public float getProgress() throws IOException { if (isReadingDone) { return 1.0f; } else return 0.0f; } @Override public Object createKey() { return new ObjectWritable(); } @Override public Object createValue() { return new ObjectWritable(); } @Override public long getPos() throws IOException { if (isReadingDone) { return 1; } else { return 0; } } @Override public boolean next(Object arg0, Object arg1) throws IOException { if (isReadingDone) { return false; } else { isReadingDone = true; return true; } } }; }