You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Luke Cwik (JIRA)" <ji...@apache.org> on 2017/07/24 12:58:00 UTC
[jira] [Comment Edited] (BEAM-2658) SerializableCoder has higher
precedence over ProtoCoder in CoderRegistry#getCoder
[ https://issues.apache.org/jira/browse/BEAM-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16098322#comment-16098322 ]
Luke Cwik edited comment on BEAM-2658 at 7/24/17 12:57 PM:
-----------------------------------------------------------
Arbitrary number based precedence orders are difficult to maintain. I agree with you that we should special case ```DefaultCoder``` and ```SerializableCoder``` for now and once we get the third or fourth special case, that may give us constraints on how we should structure coder provider ordering.
was (Author: lcwik):
Arbitrary number based precedence orders are difficult to maintain. I agree with you that we should special case `DefaultCoder` and `SerializableCoder` for now and once we get the third or fourth special case, that may give us constraints on how we should structure coder provider ordering.
> SerializableCoder has higher precedence over ProtoCoder in CoderRegistry#getCoder
> ---------------------------------------------------------------------------------
>
> Key: BEAM-2658
> URL: https://issues.apache.org/jira/browse/BEAM-2658
> Project: Beam
> Issue Type: Bug
> Components: sdk-java-core
> Affects Versions: 2.0.0
> Reporter: Neville Li
> Assignee: Davor Bonaci
> Priority: Minor
>
> {code}
> import com.google.protobuf.Timestamp;
> import org.apache.beam.sdk.Pipeline;
> import org.apache.beam.sdk.coders.CannotProvideCoderException;
> import org.apache.beam.sdk.coders.Coder;
> import org.apache.beam.sdk.options.PipelineOptions;
> import org.apache.beam.sdk.options.PipelineOptionsFactory;
> public class CoderTest {
> public static void main(String[] args) throws CannotProvideCoderException {
> PipelineOptions options = PipelineOptionsFactory.fromArgs(args).create();
> Pipeline pipeline = Pipeline.create(options);
> Coder<Timestamp> coder = pipeline.getCoderRegistry().getCoder(Timestamp.class);
> // class org.apache.beam.sdk.coders.SerializableCoder
> System.out.println(coder.getClass());
> }
> }
> {code}
> Right now we're sorting {{CoderProviderRegistrar}}s by canonical name but {{SerializableCoderProvider}} should be added last as a fallback if there're other {{CoderProvider}}s that support the same type.
> {code}
> Set<CoderProviderRegistrar> registrars = Sets.newTreeSet(ObjectsClassComparator.INSTANCE);
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)