Package org.apache.beam.sdk.transforms
Class WithFailures.ExceptionAsMapHandler<T>
java.lang.Object
org.apache.beam.sdk.transforms.InferableFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>
org.apache.beam.sdk.transforms.SimpleFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>
org.apache.beam.sdk.transforms.WithFailures.ExceptionAsMapHandler<T>
- All Implemented Interfaces:
Serializable
,HasDisplayData
,ProcessFunction<WithFailures.ExceptionElement<T>,
,KV<T, Map<String, String>>> SerializableFunction<WithFailures.ExceptionElement<T>,
KV<T, Map<String, String>>>
- Enclosing class:
WithFailures
public static class WithFailures.ExceptionAsMapHandler<T>
extends SimpleFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>
A simple handler that extracts information from an exception to a
Map<String, String>
and returns a KV
where the key is the input element that failed processing, and the
value is the map of exception attributes.
Extends SimpleFunction
so that full type information is captured. Map and KV
coders are well supported by Beam, so coder inference can be successfully applied if the
consuming transform passes type information to the failure collection's TupleTag
.
The keys populated in the map are "className", "message", and "stackTrace" of the exception.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.beam.sdk.transforms.SimpleFunction
fromSerializableFunctionWithOutputType
Methods inherited from class org.apache.beam.sdk.transforms.InferableFunction
fromProcessFunctionWithOutputType, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData
-
Constructor Details
-
ExceptionAsMapHandler
public ExceptionAsMapHandler()
-
-
Method Details
-
apply
Description copied from interface:ProcessFunction
Returns the result of invoking this function on the given input.- Specified by:
apply
in interfaceProcessFunction<WithFailures.ExceptionElement<T>,
KV<T, Map<String, String>>> - Specified by:
apply
in interfaceSerializableFunction<WithFailures.ExceptionElement<T>,
KV<T, Map<String, String>>> - Overrides:
apply
in classSimpleFunction<WithFailures.ExceptionElement<T>,
KV<T, Map<String, String>>>
-