public class ApexStreamImpl<T> extends Object implements ApexStream<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
ApexStreamImpl.Brick<T>
The extension point of the stream
|
| Constructor and Description |
|---|
ApexStreamImpl() |
ApexStreamImpl(ApexStream<T> apexStream) |
ApexStreamImpl(DagMeta graph) |
ApexStreamImpl(DagMeta graph,
ApexStreamImpl.Brick<T> lastBrick) |
| Modifier and Type | Method and Description |
|---|---|
<O,STREAM extends ApexStream<O>> |
addOperator(com.datatorrent.api.Operator op,
com.datatorrent.api.Operator.InputPort<T> inputPort,
com.datatorrent.api.Operator.OutputPort<O> outputPort)
Extend the dag by adding one operator
|
<O,STREAM extends ApexStream<O>> |
addOperator(String opName,
com.datatorrent.api.Operator op,
com.datatorrent.api.Operator.InputPort<T> inputPort,
com.datatorrent.api.Operator.OutputPort<O> outputPort)
Extend the dag by adding one
Operator |
<STREAM extends ApexStream<Integer>> |
count()
Count of all tuples
|
<STREAM extends ApexStream<Map<Object,Integer>>> |
countByKey()
Count tuples by the key
If the input is KeyedTuple it will get the key from getKey method from the tuple If not, use the tuple itself as a key |
<STREAM extends ApexStream<Map<Object,Integer>>> |
countByKey(int key)
Count tuples by the indexed key
|
com.datatorrent.api.DAG |
createDag()
Create dag from stream
|
<STREAM extends ApexStream<T>> |
filter(Function.FilterFunction<T> filter)
Filter transformation
Add an operator to the DAG which filter out tuple T that cannot satisfy the FilterFunction |
<STREAM extends ApexStream<T>> |
filter(String name,
Function.FilterFunction<T> filter)
Filter transformation
Add an operator to the DAG which filter out tuple T that cannot satisfy the FilterFunction |
<O,STREAM extends ApexStream<O>> |
flatMap(Function.FlatMapFunction<T,O> flatten)
Flat map transformation
Add an operator to the DAG which convert tuple T to a collection of tuple O
|
<O,STREAM extends ApexStream<O>> |
flatMap(String name,
Function.FlatMapFunction<T,O> flatten)
Flat map transformation
Add an operator to the DAG which convert tuple T to a collection of tuple O |
<O,STREAM extends ApexStream<O>> |
fold(O initialValue,
Function.FoldFunction<T,O> fold)
Fold transformation
Add an operator to the DAG which merge tuple T to accumulated result tuple O |
<O,STREAM extends ApexStream<O>> |
fold(String name,
O initialValue,
Function.FoldFunction<T,O> fold)
Fold transformation
Add an operator to the DAG which merge tuple T to accumulated result tuple O |
ApexStreamImpl.Brick<T> |
getLastBrick() |
<O,STREAM extends ApexStream<O>> |
map(Function.MapFunction<T,O> mf)
Simple map transformation
Add an operator to the DAG which convert tuple T to tuple O |
<O,STREAM extends ApexStream<O>> |
map(String name,
Function.MapFunction<T,O> mf)
Simple map transformation
Add an operator to the DAG which convert tuple T to tuple O |
void |
populateDag(com.datatorrent.api.DAG dag)
Populate existing dag
|
ApexStreamImpl<T> |
print()
Add a stdout console output operator
|
ApexStream<T> |
printErr()
Add a stderr console output operator
|
<STREAM extends ApexStream<T>> |
reduce(Function.ReduceFunction<T> reduce)
Reduce transformation
Add an operator to the DAG which merge tuple t1, t2 to new tuple |
<STREAM extends ApexStream<T>> |
reduce(String name,
Function.ReduceFunction<T> reduce)
Reduce transformation
Add an operator to the DAG which merge tuple t1, t2 to new tuple |
void |
run()
Submit the application to cluster
|
void |
runEmbedded(boolean async,
long duration,
Callable<Boolean> exitCondition)
Run the stream application in local mode
In Async mode, the method would return immediately and the dag would run for "duration" milliseconds
In Sync mode, the method would block "duration" milliseconds to run the dag
If duration is negative the dag would run forever until being killed
|
ApexStream<T> |
setGlobalAttribute(com.datatorrent.api.Attribute attribute,
Object value)
Set attributes at the DAG level
|
void |
setLastBrick(ApexStreamImpl.Brick<T> lastBrick) |
<STREAM extends ApexStream<T>> |
union(ApexStream<T>... others)
Union multiple stream into one
|
ApexStream<T> |
with(com.datatorrent.api.Attribute attribute,
Object value)
Set the attribute value
If it is DAG attribute, it will be applied to the whole DAG If it is Operator attribute, it will be applied to last connected operatorIf it is InputPort attribute, it will be applied to the input port of the last connected streamIf it is OutputPort attribute, it will be applied to the output port of the last connected streamIf it is both InputPort&OutputPort attribute, it will be applied to last connected stream |
ApexStream<T> |
with(com.datatorrent.api.DAG.Locality locality)
Set the locality
|
ApexStream<T> |
with(String propName,
Object value)
Set the property value of the last connected operator
|
public ApexStreamImpl()
public ApexStreamImpl(ApexStream<T> apexStream)
public ApexStreamImpl(DagMeta graph)
public ApexStreamImpl(DagMeta graph, ApexStreamImpl.Brick<T> lastBrick)
public ApexStreamImpl.Brick<T> getLastBrick()
public void setLastBrick(ApexStreamImpl.Brick<T> lastBrick)
public <O,STREAM extends ApexStream<O>> STREAM map(Function.MapFunction<T,O> mf)
ApexStreammap in interface ApexStream<T>O - Type of the outputmf - map functionpublic <O,STREAM extends ApexStream<O>> STREAM map(String name, Function.MapFunction<T,O> mf)
ApexStreammap in interface ApexStream<T>O - Type of the outputname - operator namemf - map functionpublic <O,STREAM extends ApexStream<O>> STREAM flatMap(Function.FlatMapFunction<T,O> flatten)
ApexStreamflatMap in interface ApexStream<T>O - Type of the outputflatten - flat mappublic <O,STREAM extends ApexStream<O>> STREAM flatMap(String name, Function.FlatMapFunction<T,O> flatten)
ApexStreamflatMap in interface ApexStream<T>O - Type of the outputname - operator namepublic <STREAM extends ApexStream<T>> STREAM filter(Function.FilterFunction<T> filter)
ApexStreamfilter in interface ApexStream<T>filter - filter functionpublic <STREAM extends ApexStream<T>> STREAM filter(String name, Function.FilterFunction<T> filter)
ApexStreamfilter in interface ApexStream<T>name - operator namefilter - filter functionpublic <STREAM extends ApexStream<T>> STREAM reduce(Function.ReduceFunction<T> reduce)
ApexStreamreduce in interface ApexStream<T>reduce - reduce functionpublic <STREAM extends ApexStream<T>> STREAM reduce(String name, Function.ReduceFunction<T> reduce)
ApexStreamreduce in interface ApexStream<T>name - operator namereduce - reduce functionpublic <O,STREAM extends ApexStream<O>> STREAM fold(O initialValue, Function.FoldFunction<T,O> fold)
ApexStreamfold in interface ApexStream<T>O - Result typeinitialValue - initial result valuefold - fold functionpublic <O,STREAM extends ApexStream<O>> STREAM fold(String name, O initialValue, Function.FoldFunction<T,O> fold)
ApexStreamfold in interface ApexStream<T>O - Result typename - name of the operatorinitialValue - initial result valuefold - fold functionpublic <STREAM extends ApexStream<Integer>> STREAM count()
ApexStreamcount in interface ApexStream<T>public <STREAM extends ApexStream<Map<Object,Integer>>> STREAM countByKey(int key)
ApexStreamcountByKey in interface ApexStream<T>key - the index of the field in the tuple that are used as keypublic <STREAM extends ApexStream<Map<Object,Integer>>> STREAM countByKey()
ApexStreamcountByKey in interface ApexStream<T>public <O,STREAM extends ApexStream<O>> STREAM addOperator(com.datatorrent.api.Operator op, com.datatorrent.api.Operator.InputPort<T> inputPort, com.datatorrent.api.Operator.OutputPort<O> outputPort)
ApexStreamaddOperator in interface ApexStream<T>O - type of the outputop - Operator added to the streaminputPort - InputPort of the operator that is connected to last exposed OutputPort in the streamoutputPort - OutputPort of the operator will be connected to next operatorpublic <O,STREAM extends ApexStream<O>> STREAM addOperator(String opName, com.datatorrent.api.Operator op, com.datatorrent.api.Operator.InputPort<T> inputPort, com.datatorrent.api.Operator.OutputPort<O> outputPort)
ApexStreamOperatoraddOperator in interface ApexStream<T>O - type of the outputopName - Operator nameop - Operator added to the streaminputPort - InputPort of the operator that is connected to last exposed OutputPort in the streamoutputPort - OutputPort of the operator will be connected to next operatorpublic <STREAM extends ApexStream<T>> STREAM union(ApexStream<T>... others)
ApexStreamunion in interface ApexStream<T>others - other streamspublic ApexStreamImpl<T> print()
ApexStreamprint in interface ApexStream<T>public ApexStream<T> printErr()
ApexStreamprintErr in interface ApexStream<T>public ApexStream<T> with(com.datatorrent.api.Attribute attribute, Object value)
ApexStreamDAG attribute, it will be applied to the whole DAG Operator attribute, it will be applied to last connected operatorInputPort attribute, it will be applied to the input port of the last connected streamOutputPort attribute, it will be applied to the output port of the last connected streamInputPort&OutputPort attribute, it will be applied to last connected streamwith in interface ApexStream<T>attribute - Attributevalue - value of the attributepublic ApexStream<T> setGlobalAttribute(com.datatorrent.api.Attribute attribute, Object value)
ApexStreamsetGlobalAttribute in interface ApexStream<T>attribute - Attributevalue - value of the attributepublic ApexStream<T> with(com.datatorrent.api.DAG.Locality locality)
ApexStreamwith in interface ApexStream<T>locality - DAG.Localitypublic ApexStream<T> with(String propName, Object value)
ApexStreamwith in interface ApexStream<T>propName - property namevalue - value of the propertypublic com.datatorrent.api.DAG createDag()
ApexStreamcreateDag in interface ApexStream<T>DAGpublic void populateDag(com.datatorrent.api.DAG dag)
ApexStreampopulateDag in interface ApexStream<T>dag - DAGpublic void runEmbedded(boolean async,
long duration,
Callable<Boolean> exitCondition)
ApexStreamrunEmbedded in interface ApexStream<T>async - true if run in Async mode
false if run in sync modepublic void run()
ApexStreamrun in interface ApexStream<T>Copyright © 2015-2016 Apache Software Foundation. All Rights Reserved.