I would like to consistently apply a custom RicherIndicatorCoder
for my case class RicherIndicator
. Moreover if I fail to provide a new Coder for Tuples
or KVs
containing RicherIndicator
then I would like to obtain a compile-time or runtime error rather than fall back on a suboptimal coder.
However Scio does not seem to honor the @DefaultCoder
annotation:
@DefaultCoder(classOf[RicherIndicatorCoder]) // Ignored
case class RicherIndicator (
policy: Policy,
indicator: Indicator
)
Nor does Scio give priority to custom coders registered with the CoderRegistry
, instead falling back on its own default coder:
val registry = sc.pipeline.getCoderRegistry
registry.registerCoderForClass(classOf[RicherIndicator], RicherIndicatorCoder.of) // Not used
Therefore I must use setCoder(RicherIndicatorCoder.of)
wherever an SCollection
of this type appears, and carefully comb through the pipeline in case there are composite types which include a RicherIndicator
.
Is there a way to set my custom coder as the default, or to disable falling back on the default Magnolia or Kryo based coder?