Package io.github.kaststream.api.v2
Interface FlatMapper
-
- All Superinterfaces:
Serializable
public interface FlatMapper extends Serializable
Implement this interface to provide your own flat map function.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Tear-down method for the user code.voidflatMap(KastRow kRow, KastCollector out, KastRowBuilder kastRowBuilder)Your function implementation.org.apache.avro.SchemagetProducedType(org.apache.avro.Schema schema)Declare the data type information of the data produced by your function.voidopen(Map<String,String> configuration, org.apache.avro.Schema schema)Initialization method for the function.
-
-
-
Method Detail
-
flatMap
void flatMap(KastRow kRow, KastCollector out, KastRowBuilder kastRowBuilder) throws Exception
Your function implementation. Do what you need on the received rows.- Parameters:
kRow- the received rowout- the output row collector- Throws:
Exception- The function may throw exceptions which cause the streaming program to fail and go into recovery.
-
getProducedType
org.apache.avro.Schema getProducedType(org.apache.avro.Schema schema)
Declare the data type information of the data produced by your function.- Parameters:
schema- the input row schema- Returns:
- the produced data typeInfo
-
open
void open(Map<String,String> configuration, org.apache.avro.Schema schema) throws Exception
Initialization method for the function.- Parameters:
configuration- The configuration containing the parameters attached to the contractschema- the input row schema- Throws:
Exception- The function may throw exceptions which cause the streaming program to fail and go into recovery.
-
close
void close() throws ExceptionTear-down method for the user code. It is called after the last call to the main working methods. For functions that are part of an iteration, this method will be invoked after each iteration superstep.This method can be used for clean up work.
- Throws:
Exception- The function may throw exceptions which cause the streaming program to fail and go into recovery.
-
-