Java Code Examples for org.apache.hadoop.util.ReflectionUtils#copy()
The following examples show how to use
org.apache.hadoop.util.ReflectionUtils#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Chain.java From big-c with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
Example 2
Source File: Chain.java From big-c with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
Example 3
Source File: MultithreadedMapper.java From RDFS with Apache License 2.0 | 5 votes |
@Override public boolean nextKeyValue() throws IOException, InterruptedException { synchronized (outer) { if (!outer.nextKeyValue()) { return false; } key = ReflectionUtils.copy(outer.getConfiguration(), outer.getCurrentKey(), key); value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value); return true; } }
Example 4
Source File: ArrayListBackedIterator.java From big-c with Apache License 2.0 | 5 votes |
public boolean next(X val) throws IOException { if (iter.hasNext()) { ReflectionUtils.copy(conf, iter.next(), val); if (null == hold) { hold = WritableUtils.clone(val, null); } else { ReflectionUtils.copy(conf, val, hold); } return true; } return false; }
Example 5
Source File: JoinRecordReader.java From big-c with Apache License 2.0 | 5 votes |
/** * Emit the next set of key, value pairs as defined by the child * RecordReaders and operation associated with this composite RR. */ public boolean nextKeyValue() throws IOException, InterruptedException { if (key == null) { key = createKey(); } if (jc.flush(value)) { ReflectionUtils.copy(conf, jc.key(), key); return true; } jc.clear(); if (value == null) { value = createValue(); } final PriorityQueue<ComposableRecordReader<K,?>> q = getRecordReaderQueue(); K iterkey = createKey(); while (q != null && !q.isEmpty()) { fillJoinCollector(iterkey); jc.reset(iterkey); if (jc.flush(value)) { ReflectionUtils.copy(conf, jc.key(), key); return true; } jc.clear(); } return false; }
Example 6
Source File: MultiFilterRecordReader.java From big-c with Apache License 2.0 | 5 votes |
public boolean next(V val) throws IOException { boolean ret; if (ret = jc.flush(ivalue)) { ReflectionUtils.copy(getConf(), emit(ivalue), val); } return ret; }
Example 7
Source File: MultithreadedTableMapper.java From hbase with Apache License 2.0 | 5 votes |
@Override public boolean nextKeyValue() throws IOException, InterruptedException { synchronized (outer) { if (!outer.nextKeyValue()) { return false; } key = ReflectionUtils.copy(outer.getConfiguration(), outer.getCurrentKey(), key); value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value); return true; } }
Example 8
Source File: MultithreadedMapper.java From big-c with Apache License 2.0 | 5 votes |
@Override public boolean nextKeyValue() throws IOException, InterruptedException { synchronized (outer) { if (!outer.nextKeyValue()) { return false; } key = ReflectionUtils.copy(outer.getConfiguration(), outer.getCurrentKey(), key); value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value); return true; } }
Example 9
Source File: WritableUtils.java From hadoop-gpu with Apache License 2.0 | 5 votes |
/** * Make a copy of a writable object using serialization to a buffer. * @param orig The object to copy * @return The copied object */ public static <T extends Writable> T clone(T orig, Configuration conf) { try { @SuppressWarnings("unchecked") // Unchecked cast from Class to Class<T> T newInst = ReflectionUtils.newInstance((Class<T>) orig.getClass(), conf); ReflectionUtils.copy(conf, orig, newInst); return newInst; } catch (IOException e) { throw new RuntimeException("Error writing/reading clone buffer", e); } }
Example 10
Source File: WritableUtils.java From RDFS with Apache License 2.0 | 5 votes |
/** * Make a copy of a writable object using serialization to a buffer. * @param orig The object to copy * @return The copied object */ public static <T extends Writable> T clone(T orig, Configuration conf) { try { @SuppressWarnings("unchecked") // Unchecked cast from Class to Class<T> T newInst = ReflectionUtils.newInstance((Class<T>) orig.getClass(), conf); ReflectionUtils.copy(conf, orig, newInst); return newInst; } catch (IOException e) { throw new RuntimeException("Error writing/reading clone buffer", e); } }
Example 11
Source File: WritableUtils.java From big-c with Apache License 2.0 | 5 votes |
/** * Make a copy of a writable object using serialization to a buffer. * @param orig The object to copy * @return The copied object */ public static <T extends Writable> T clone(T orig, Configuration conf) { try { @SuppressWarnings("unchecked") // Unchecked cast from Class to Class<T> T newInst = ReflectionUtils.newInstance((Class<T>) orig.getClass(), conf); ReflectionUtils.copy(conf, orig, newInst); return newInst; } catch (IOException e) { throw new RuntimeException("Error writing/reading clone buffer", e); } }
Example 12
Source File: Chain.java From hadoop with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
Example 13
Source File: RandomKeyDistributionMapper.java From Kylin with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void map(KEY key, VALUE value, Context context) throws IOException, InterruptedException { KEY keyCopy = (KEY) ReflectionUtils.newInstance(key.getClass(), conf); ReflectionUtils.copy(conf, key, keyCopy); allKeys.add(keyCopy); }
Example 14
Source File: MultithreadedMapper.java From hadoop-gpu with Apache License 2.0 | 5 votes |
@Override public boolean nextKeyValue() throws IOException, InterruptedException { synchronized (outer) { if (!outer.nextKeyValue()) { return false; } key = ReflectionUtils.copy(outer.getConfiguration(), outer.getCurrentKey(), key); value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value); return true; } }
Example 15
Source File: MultiFilterRecordReader.java From hadoop with Apache License 2.0 | 5 votes |
public boolean next(V val) throws IOException { boolean ret; if (ret = jc.flush(ivalue)) { ReflectionUtils.copy(getConf(), emit(ivalue), val); } return ret; }
Example 16
Source File: MultiFilterRecordReader.java From hadoop with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ public boolean nextKeyValue() throws IOException, InterruptedException { if (key == null) { key = createKey(); } if (value == null) { value = createValue(); } if (jc.flush(ivalue)) { ReflectionUtils.copy(conf, jc.key(), key); ReflectionUtils.copy(conf, emit(ivalue), value); return true; } if (ivalue == null) { ivalue = createTupleWritable(); } jc.clear(); final PriorityQueue<ComposableRecordReader<K,?>> q = getRecordReaderQueue(); K iterkey = createKey(); while (q != null && !q.isEmpty()) { fillJoinCollector(iterkey); jc.reset(iterkey); if (jc.flush(ivalue)) { ReflectionUtils.copy(conf, jc.key(), key); ReflectionUtils.copy(conf, emit(ivalue), value); return true; } jc.clear(); } return false; }
Example 17
Source File: WrappedRecordReader.java From hadoop with Apache License 2.0 | 4 votes |
/** * Clone the key at the head of this RR into the object supplied. */ public void key(K qkey) throws IOException { ReflectionUtils.copy(conf, key, qkey); }
Example 18
Source File: ArrayListBackedIterator.java From hadoop with Apache License 2.0 | 4 votes |
public boolean replay(X val) throws IOException { ReflectionUtils.copy(conf, hold, val); return true; }
Example 19
Source File: MultiFilterRecordReader.java From big-c with Apache License 2.0 | 4 votes |
public boolean replay(V val) throws IOException { ReflectionUtils.copy(getConf(), emit(ivalue), val); return true; }
Example 20
Source File: MultiFilterRecordReader.java From hadoop with Apache License 2.0 | 4 votes |
public boolean replay(V val) throws IOException { ReflectionUtils.copy(getConf(), emit(ivalue), val); return true; }