cascading.scheme.SourceCall Java Examples
The following examples show how to use
cascading.scheme.SourceCall.
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: HBaseRawScheme.java From SpyGlass with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException { Tuple result = new Tuple(); Object key = sourceCall.getContext()[0]; Object value = sourceCall.getContext()[1]; boolean hasNext = sourceCall.getInput().next(key, value); if (!hasNext) { return false; } // Skip nulls if (key == null || value == null) { return true; } ImmutableBytesWritable keyWritable = (ImmutableBytesWritable) key; Result row = (Result) value; result.add(keyWritable); result.add(row); sourceCall.getIncomingEntry().setTuple(result); return true; }
Example #2
Source File: FlinkConfigDefScheme.java From cascading-flink with Apache License 2.0 | 5 votes |
@Override public void sourcePrepare( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) { if( !( flowProcess instanceof FlowProcessWrapper) ) { throw new RuntimeException( "not a flow process wrapper" ); } if( !"process-default".equals( flowProcess.getProperty( "default" ) ) ) { throw new RuntimeException("not default value"); } if( !"source-replace".equals( flowProcess.getProperty( "replace" ) ) ) { throw new RuntimeException( "not replaced value" ); } if( !"node-replace".equals( flowProcess.getProperty( "default-node" ) ) ) { throw new RuntimeException( "not replaced value" ); } flowProcess = ( (FlowProcessWrapper) flowProcess ).getDelegate(); if( !"process-default".equals( flowProcess.getProperty( "default" ) ) ) { throw new RuntimeException( "not default value" ); } if( !"process-replace".equals( flowProcess.getProperty( "replace" ) ) ) { throw new RuntimeException( "not replaced value" ); } super.sourcePrepare( flowProcess, sourceCall ); }
Example #3
Source File: ParquetValueScheme.java From parquet-mr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<JobConf> fp, SourceCall<Object[], RecordReader> sc) throws IOException { Container<T> value = (Container<T>) sc.getInput().createValue(); boolean hasNext = sc.getInput().next(null, value); if (!hasNext) { return false; } // Skip nulls if (value == null) { return true; } sc.getIncomingEntry().setTuple(new Tuple(value.get())); return true; }
Example #4
Source File: ParquetTupleScheme.java From parquet-mr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<JobConf> fp, SourceCall<Object[], RecordReader> sc) throws IOException { Container<Tuple> value = (Container<Tuple>) sc.getInput().createValue(); boolean hasNext = sc.getInput().next(null, value); if (!hasNext) { return false; } // Skip nulls if (value == null) { return true; } sc.getIncomingEntry().setTuple(value.get()); return true; }
Example #5
Source File: ParquetValueScheme.java From parquet-mr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<? extends JobConf> fp, SourceCall<Object[], RecordReader> sc) throws IOException { Container<T> value = (Container<T>) sc.getInput().createValue(); boolean hasNext = sc.getInput().next(null, value); if (!hasNext) { return false; } // Skip nulls if (value == null) { return true; } sc.getIncomingEntry().setTuple(new Tuple(value.get())); return true; }
Example #6
Source File: ParquetTupleScheme.java From parquet-mr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<? extends JobConf> fp, SourceCall<Object[], RecordReader> sc) throws IOException { Container<Tuple> value = (Container<Tuple>) sc.getInput().createValue(); boolean hasNext = sc.getInput().next(null, value); if (!hasNext) { return false; } // Skip nulls if (value == null) { return true; } sc.getIncomingEntry().setTuple(value.get()); return true; }
Example #7
Source File: TupleScheme.java From plunger with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public boolean source(FlowProcess<? extends Properties> flowProcess, SourceCall<Void, Iterator<Tuple>> sourceCall) throws IOException { if (sourceCall.getInput().hasNext()) { sourceCall.getIncomingEntry().setTuple(sourceCall.getInput().next()); return true; } return false; }
Example #8
Source File: JDBCScheme.java From SpyGlass with Apache License 2.0 | 5 votes |
@Override public void sourcePrepare( FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) { Object[] pair = new Object[]{sourceCall.getInput().createKey(), sourceCall.getInput().createValue()}; sourceCall.setContext( pair ); }
Example #9
Source File: JDBCScheme.java From SpyGlass with Apache License 2.0 | 5 votes |
@Override public boolean source( FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) throws IOException { Object key = sourceCall.getContext()[ 0 ]; Object value = sourceCall.getContext()[ 1 ]; boolean result = sourceCall.getInput().next( key, value ); if( !result ) return false; Tuple newTuple = ( (TupleRecord) value ).getTuple(); sourceCall.getIncomingEntry().setTuple( newTuple ); return true; }
Example #10
Source File: HBaseScheme.java From SpyGlass with Apache License 2.0 | 5 votes |
@Override public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { Object[] pair = new Object[]{sourceCall.getInput().createKey(), sourceCall.getInput().createValue()}; sourceCall.setContext(pair); }
Example #11
Source File: HBaseScheme.java From SpyGlass with Apache License 2.0 | 5 votes |
@Override public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException { Tuple result = new Tuple(); Object key = sourceCall.getContext()[0]; Object value = sourceCall.getContext()[1]; boolean hasNext = sourceCall.getInput().next(key, value); if (!hasNext) { return false; } // Skip nulls if (key == null || value == null) { return true; } ImmutableBytesWritable keyWritable = (ImmutableBytesWritable) key; Result row = (Result) value; result.add(keyWritable); for (int i = 0; i < this.familyNames.length; i++) { String familyName = this.familyNames[i]; byte[] familyNameBytes = Bytes.toBytes(familyName); Fields fields = this.valueFields[i]; for (int k = 0; k < fields.size(); k++) { String fieldName = (String) fields.get(k); byte[] fieldNameBytes = Bytes.toBytes(fieldName); byte[] cellValue = row.getValue(familyNameBytes, fieldNameBytes); result.add(cellValue != null ? new ImmutableBytesWritable(cellValue) : null); } } sourceCall.getIncomingEntry().setTuple(result); return true; }
Example #12
Source File: JDBCScheme.java From SpyGlass with Apache License 2.0 | 4 votes |
@Override public void sourceCleanup( FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) { sourceCall.setContext( null ); }
Example #13
Source File: HBaseRawScheme.java From SpyGlass with Apache License 2.0 | 4 votes |
@Override public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { Object[] pair = new Object[] { sourceCall.getInput().createKey(), sourceCall.getInput().createValue() }; sourceCall.setContext(pair); }
Example #14
Source File: HBaseRawScheme.java From SpyGlass with Apache License 2.0 | 4 votes |
@Override public void sourceCleanup(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { sourceCall.setContext(null); }
Example #15
Source File: HBaseScheme.java From SpyGlass with Apache License 2.0 | 4 votes |
@Override public void sourceCleanup(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { sourceCall.setContext(null); }