T - public interface ApexStream<T>
| 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 |
<O,STREAM extends ApexStream<O>> |
map(Function.MapFunction<T,O> mapFunction)
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> mapFunction)
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
|
<STREAM extends ApexStream<T>> |
print()
Add a stdout console output operator
|
<STREAM extends 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
|
<STREAM extends ApexStream<T>> |
setGlobalAttribute(com.datatorrent.api.Attribute attribute,
Object value)
Set attributes at the DAG level
|
<STREAM extends ApexStream<T>> |
union(ApexStream<T>... others)
Union multiple stream into one
|
<STREAM extends 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 |
<STREAM extends ApexStream<T>> |
with(com.datatorrent.api.DAG.Locality locality)
Set the locality
|
<STREAM extends ApexStream<T>> |
with(String propName,
Object value)
Set the property value of the last connected operator
|
<O,STREAM extends ApexStream<O>> STREAM map(Function.MapFunction<T,O> mapFunction)
O - Type of the outputmapFunction - map function<O,STREAM extends ApexStream<O>> STREAM map(String name, Function.MapFunction<T,O> mapFunction)
O - Type of the outputname - operator namemapFunction - map function<O,STREAM extends ApexStream<O>> STREAM flatMap(Function.FlatMapFunction<T,O> flatten)
O - Type of the outputflatten - flat map<O,STREAM extends ApexStream<O>> STREAM flatMap(String name, Function.FlatMapFunction<T,O> flatten)
O - Type of the outputname - operator nameflatten - <STREAM extends ApexStream<T>> STREAM filter(Function.FilterFunction<T> filter)
filter - filter function<STREAM extends ApexStream<T>> STREAM filter(String name, Function.FilterFunction<T> filter)
name - operator namefilter - filter function<STREAM extends ApexStream<T>> STREAM reduce(Function.ReduceFunction<T> reduce)
reduce - reduce function<STREAM extends ApexStream<T>> STREAM reduce(String name, Function.ReduceFunction<T> reduce)
name - operator namereduce - reduce function<O,STREAM extends ApexStream<O>> STREAM fold(O initialValue, Function.FoldFunction<T,O> fold)
O - Result typeinitialValue - initial result valuefold - fold function<O,STREAM extends ApexStream<O>> STREAM fold(String name, O initialValue, Function.FoldFunction<T,O> fold)
O - Result typename - name of the operatorinitialValue - initial result valuefold - fold function<STREAM extends ApexStream<Integer>> STREAM count()
<STREAM extends ApexStream<Map<Object,Integer>>> STREAM countByKey()
<STREAM extends ApexStream<Map<Object,Integer>>> STREAM countByKey(int key)
key - the index of the field in the tuple that are used as key<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)
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 operator<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)
OperatorO - 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 operator<STREAM extends ApexStream<T>> STREAM union(ApexStream<T>... others)
others - other streams<STREAM extends ApexStream<T>> STREAM print()
<STREAM extends ApexStream<T>> STREAM printErr()
<STREAM extends ApexStream<T>> STREAM with(com.datatorrent.api.Attribute attribute, Object value)
DAG 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 streamattribute - Attributevalue - value of the attribute<STREAM extends ApexStream<T>> STREAM setGlobalAttribute(com.datatorrent.api.Attribute attribute, Object value)
attribute - Attributevalue - value of the attribute<STREAM extends ApexStream<T>> STREAM with(com.datatorrent.api.DAG.Locality locality)
locality - DAG.Locality<STREAM extends ApexStream<T>> STREAM with(String propName, Object value)
propName - property namevalue - value of the propertycom.datatorrent.api.DAG createDag()
DAGvoid populateDag(com.datatorrent.api.DAG dag)
dag - DAGvoid runEmbedded(boolean async,
long duration,
Callable<Boolean> exitCondition)
async - true if run in Async mode
false if run in sync modevoid run()
Copyright © 2015-2016 Apache Software Foundation. All Rights Reserved.