You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by chinmaykolhatkar <gi...@git.apache.org> on 2016/06/13 22:30:43 UTC

[GitHub] apex-malhar pull request #302: [APEXMALHAR-139] Make Sigma Operator Partitio...

Github user chinmaykolhatkar commented on a diff in the pull request:

    https://github.com/apache/apex-malhar/pull/302#discussion_r66880779
  
    --- Diff: library/src/main/java/com/datatorrent/lib/math/AbstractOutput.java ---
    @@ -38,23 +38,23 @@
        * Double type output.
        */
       @OutputPortFieldAnnotation(optional = true)
    -  public final transient DefaultOutputPort<Double> doubleResult = new DefaultOutputPort<Double>();
    +  public transient DefaultOutputPort<Double> doubleResult = new DefaultOutputPort<Double>();
    --- End diff --
    
    @ilganeli This won't work. The purpose of keeping port variable final is because this variable is used in Application.java to connect the ports. Once its used in addStream in application.java, the reference to this variable is kept and the same object will be used. Hence even if the object is recreated in child class, that won't take effect.
    
    Suggested approach for adding unifier to super class's port is as follows:
    
    1. Do following in parent class:
    ``
    public final transient DefaultOutputPort<Double> doubleResult = new DefaultOutputPort<>()
    {
       @Override
      public Operator.Unifier getUnifier()
      {
         return getUnifier();
      }
    }
    
    protected Operator.Unifier getUnifier()
    {
       return null;
    }
    ``
    2. Do following in child class:
    ``
    @Override
    protected Operator.Unifier<Double> getUnifier()
    {
        return new UnifierSumNumber<>();
    }
    ``


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---