apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gauravgopi123 <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEXCORE-272 copy operator and p...
Date Tue, 29 Dec 2015 20:55:53 GMT
Github user gauravgopi123 commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/191#discussion_r48569051
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/plan/logical/LogicalPlan.java ---
    @@ -907,6 +912,51 @@ else if (field.getType() == float.class || field.getType() == Float.class
||
             getValue(OperatorContext.METRICS_DIMENSIONS_SCHEME));
         }
     
    +    /**
    +     * Copy attribute from source attributeMap to destination attributeMap.
    +     *
    +     * @param dest  destination attribute map.
    +     * @param source source attribute map.
    +     */
    +    private void copyAttributes(AttributeMap dest, AttributeMap source)
    +    {
    +      for (Entry<Attribute<?>, ?> a : source.entrySet()) {
    +        dest.put((Attribute<Object>)a.getKey(), a.getValue());
    +      }
    +    }
    +
    +    /**
    +     * Copy attribute of operator and port from provided operatorMeta. This function
requires
    +     * operatorMeta argument is for the same operator.
    +     *
    +     * @param operatorMeta copy attribute from this OperatorMeta to the object.
    +     */
    +    private void copyFrom(OperatorMeta operatorMeta)
    +    {
    +      if (operator != operatorMeta.getOperator()) {
    +        throw new IllegalArgumentException("Operator meta is not for the same operator
");
    +      }
    +
    +      // copy operator attributes
    +      copyAttributes(attributes, operatorMeta.getAttributes());
    +
    +      // copy Input port attributes
    +      for (Map.Entry<InputPort<?>, InputPortMeta> entry : operatorMeta.getPortMapping().inPortMap.entrySet())
{
    +        InputPort<?> key = entry.getKey();
    +        InputPortMeta dest = getPortMapping().inPortMap.get(key);
    +        InputPortMeta source = entry.getValue();
    +        copyAttributes(dest.attributes, source.attributes);
    +      }
    +
    +      // copy Output port attributes
    +      for (Map.Entry<OutputPort<?>, OutputPortMeta> entry : operatorMeta.getPortMapping().outPortMap.entrySet())
{
    +        OutputPort<?> key = entry.getKey();
    +        OutputPortMeta dest = getPortMapping().outPortMap.get(key);
    +        OutputPortMeta source = entry.getValue();
    +        copyAttributes(dest.attributes, source.attributes);
    --- End diff --
    
    same feedback as for input ports


---
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.
---

Mime
View raw message