Class StreamletShadow<R>
- java.lang.Object
-
- org.apache.heron.streamlet.impl.StreamletBaseImpl<R>
-
- org.apache.heron.streamlet.impl.StreamletImpl<R>
-
- org.apache.heron.streamlet.impl.streamlets.StreamletShadow<R>
-
- All Implemented Interfaces:
Streamlet<R>,StreamletBase<R>
- Direct Known Subclasses:
KVStreamletShadow
public class StreamletShadow<R> extends StreamletImpl<R>
StreamletShadow is a special kind of StreamletImpl object: - It is still an StreamletImpl therefore it supports all Streamlet functions like filter() and map(), and can be the parent object of other StreamletImpl objects. Therefore, from API point of view, it can be used in the same way as a normal StreamletImpl object. - However it is just an shadow object of a real StreamletImpl object and it doesn't represent a node in the topology DAG. Therefore it can not be a child of another StreamletImpl object. As the result, the shadow object is clonable, and it is fine to create multiple StreamletShadow objects pointing to the same StreamletImpl object and have different properties. A StreamletShadow object can be used to decorate the real Streamletimpl object. This is important for children StreamletImpl objects to consume output data from the same parent in different ways, such as selecting different stream. Usage: To create a shadow object that selecting "test" stream from an existing StreamletImpl object(stream): StreamletImpl shadow = new StreamletShadow(stream) { Override public String getStreamId() { return "test"; } }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.heron.streamlet.impl.StreamletBaseImpl
StreamletBaseImpl.StreamletNamePrefix
-
-
Field Summary
-
Fields inherited from class org.apache.heron.streamlet.impl.StreamletBaseImpl
name, nPartitions
-
-
Constructor Summary
Constructors Constructor Description StreamletShadow(StreamletImpl<R> real)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaddChild(StreamletBaseImpl<T> child)voidbuild(TopologyBuilder bldr, Set<String> stageNames)booleandoBuild(TopologyBuilder bldr, Set<String> stageNames)List<StreamletBaseImpl<?>>getChildren()Gets all the children of this streamlet.StringgetName()Gets the name of the Streamlet.intgetNumPartitions()Gets the number of partitions of this Streamlet.StreamletImpl<R>getReal()StringgetStreamId()Gets the stream id of this Streamlet.StreamletShadow<R>setName(String sName)Sets the name of the Streamlet.StreamletShadow<R>setNumPartitions(int numPartitions)Sets the number of partitions of the streamlet-
Methods inherited from class org.apache.heron.streamlet.impl.StreamletImpl
applyOperator, applyOperator, clone, consume, countByKey, countByKeyAndWindow, filter, flatMap, getAvailableStreamIds, join, join, keyBy, keyBy, log, map, reduceByKey, reduceByKey, reduceByKeyAndWindow, reduceByKeyAndWindow, repartition, repartition, split, toSink, transform, union, withStream
-
Methods inherited from class org.apache.heron.streamlet.impl.StreamletBaseImpl
isBuilt, isFullyBuilt, setDefaultNameIfNone
-
-
-
-
Constructor Detail
-
StreamletShadow
public StreamletShadow(StreamletImpl<R> real)
-
-
Method Detail
-
getReal
public StreamletImpl<R> getReal()
-
getStreamId
public String getStreamId()
Gets the stream id of this Streamlet.- Specified by:
getStreamIdin interfaceStreamlet<R>- Overrides:
getStreamIdin classStreamletImpl<R>- Returns:
- the stream id of this Streamlet
-
setName
public StreamletShadow<R> setName(String sName)
Description copied from class:StreamletImplSets the name of the Streamlet.- Specified by:
setNamein interfaceStreamlet<R>- Specified by:
setNamein interfaceStreamletBase<R>- Overrides:
setNamein classStreamletImpl<R>- Parameters:
sName- The name given by the user for this streamlet- Returns:
- Returns back the Streamlet with changed name
-
getName
public String getName()
Description copied from class:StreamletBaseImplGets the name of the Streamlet.- Specified by:
getNamein interfaceStreamlet<R>- Specified by:
getNamein interfaceStreamletBase<R>- Overrides:
getNamein classStreamletBaseImpl<R>- Returns:
- Returns the name of the Streamlet
-
setNumPartitions
public StreamletShadow<R> setNumPartitions(int numPartitions)
Description copied from class:StreamletImplSets the number of partitions of the streamlet- Specified by:
setNumPartitionsin interfaceStreamlet<R>- Specified by:
setNumPartitionsin interfaceStreamletBase<R>- Overrides:
setNumPartitionsin classStreamletImpl<R>- Parameters:
numPartitions- The user assigned number of partitions- Returns:
- Returns back the Streamlet with changed number of partitions
-
getNumPartitions
public int getNumPartitions()
Description copied from class:StreamletBaseImplGets the number of partitions of this Streamlet.- Specified by:
getNumPartitionsin interfaceStreamlet<R>- Specified by:
getNumPartitionsin interfaceStreamletBase<R>- Overrides:
getNumPartitionsin classStreamletBaseImpl<R>- Returns:
- the number of partitions of this Streamlet
-
addChild
public <T> void addChild(StreamletBaseImpl<T> child)
- Overrides:
addChildin classStreamletBaseImpl<R>
-
getChildren
public List<StreamletBaseImpl<?>> getChildren()
Gets all the children of this streamlet. Children of a streamlet are streamlets that are resulting from transformations of elements of this and potentially other streamlets.- Overrides:
getChildrenin classStreamletBaseImpl<R>- Returns:
- The kid streamlets
-
build
public void build(TopologyBuilder bldr, Set<String> stageNames)
- Overrides:
buildin classStreamletBaseImpl<R>
-
doBuild
public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames)
- Specified by:
doBuildin classStreamletBaseImpl<R>
-
-