K1 - the type of the keys in the input PCollectionK2 - the type of the keys in the output PCollectionpublic class MapKeys<K1,K2,V> extends PTransform<PCollection<KV<K1,V>>,PCollection<KV<K2,V>>>
MapKeys maps a SerializableFunction<K1,K2> over keys of a PCollection<KV<K1,V>> and returns a PCollection<KV<K2, V>>.
 Example of use:
 PCollection<KV<Integer, String>> input = ...;
 PCollection<KV<Double, String> output =
      input.apply(MapKeys.into(TypeDescriptors.doubles()).via(Integer::doubleValue));
 See also MapValues.
annotations, name, resourceHints| Modifier and Type | Method and Description | 
|---|---|
| <FailureT> org.apache.beam.sdk.transforms.SimpleMapWithFailures<KV<K1,V>,KV<K2,V>,FailureT> | exceptionsInto(TypeDescriptor<FailureT> failureTypeDescriptor)Returns a new  SimpleMapWithFailurestransform that catches exceptions raised while
 mapping elements, with the given type descriptor used for the failure collection but the
 exception handler yet to be specified usingSimpleMapWithFailures.exceptionsVia(ProcessFunction). | 
| <FailureT> org.apache.beam.sdk.transforms.SimpleMapWithFailures<KV<K1,V>,KV<K2,V>,FailureT> | exceptionsVia(InferableFunction<WithFailures.ExceptionElement<KV<K1,V>>,FailureT> exceptionHandler)Returns a new  SimpleMapWithFailurestransform that catches exceptions raised while
 mapping elements, passing the raised exception instance and the input element being processed
 through the givenexceptionHandlerand emitting the result to a failure collection. | 
| PCollection<KV<K2,V>> | expand(PCollection<KV<K1,V>> input)Override this method to specify how this  PTransformshould be expanded on the givenInputT. | 
| static <K2> MapKeys<?,K2,?> | into(TypeDescriptor<K2> outputType)Returns a new  MapKeystransform with the given type descriptor for the output type, but
 the mapping function yet to be specified usingvia(SerializableFunction). | 
| <NewValueT,NewKeyT> | via(SerializableFunction<NewKeyT,K2> fn)Returns a  MapKeys<K1, K2, V>PTransformfor aProcessFunction<NewK1,
 K2>with predefinedoutputType. | 
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setResourceHints, toString, validate, validatepublic <NewValueT,NewKeyT> MapKeys<NewKeyT,K2,NewValueT> via(SerializableFunction<NewKeyT,K2> fn)
MapKeys<K1, K2, V> PTransform for a ProcessFunction<NewK1,
 K2> with predefined outputType.NewKeyT - the type of the keys in the input PCollectionNewValueT - the type of the values in the input and output PCollectionspublic static <K2> MapKeys<?,K2,?> into(TypeDescriptor<K2> outputType)
MapKeys transform with the given type descriptor for the output type, but
 the mapping function yet to be specified using via(SerializableFunction).@RequiresNonNull(value="fn") public <FailureT> org.apache.beam.sdk.transforms.SimpleMapWithFailures<KV<K1,V>,KV<K2,V>,FailureT> exceptionsInto(TypeDescriptor<FailureT> failureTypeDescriptor)
SimpleMapWithFailures transform that catches exceptions raised while
 mapping elements, with the given type descriptor used for the failure collection but the
 exception handler yet to be specified using SimpleMapWithFailures.exceptionsVia(ProcessFunction).
 See WithFailures documentation for usage patterns of the returned WithFailures.Result.
 
Example usage:
 Result<PCollection<KV<Integer, String>>, String> result =
         input.apply(
             MapKeys.into(TypeDescriptors.integers())
                 .<String, String>via(word -> 1 / word.length)  // Could throw ArithmeticException
                 .exceptionsInto(TypeDescriptors.strings())
                 .exceptionsVia(ee -> ee.exception().getMessage()));
 PCollection<KV<Integer, String>> output = result.output();
 PCollection<String> failures = result.failures();
 @RequiresNonNull(value="fn") public <FailureT> org.apache.beam.sdk.transforms.SimpleMapWithFailures<KV<K1,V>,KV<K2,V>,FailureT> exceptionsVia(InferableFunction<WithFailures.ExceptionElement<KV<K1,V>>,FailureT> exceptionHandler)
SimpleMapWithFailures transform that catches exceptions raised while
 mapping elements, passing the raised exception instance and the input element being processed
 through the given exceptionHandler and emitting the result to a failure collection.
 This method takes advantage of the type information provided by InferableFunction,
 meaning that a call to exceptionsInto(TypeDescriptor) may not be necessary.
 
See WithFailures documentation for usage patterns of the returned WithFailures.Result.
 
Example usage:
{@code
 Result>, String> result =
         input.apply(
             MapKeys.into(TypeDescriptors.integers())
                 .via(word -> 1 / word.length)  // Could throw ArithmeticException
                 .exceptionsVia(
                     new InferableFunction>, String>() {   public PCollection<KV<K2,V>> expand(PCollection<KV<K1,V>> input)
PTransformPTransform should be expanded on the given
 InputT.
 NOTE: This method should not be called directly. Instead apply the PTransform should
 be applied to the InputT using the apply method.
 
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand in class PTransform<PCollection<KV<K1,V>>,PCollection<KV<K2,V>>>