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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to