apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tweise <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEX-103: Add module and dag int...
Date Thu, 10 Dec 2015 04:41:08 GMT
Github user tweise commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/148#discussion_r47188428
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/plan/logical/LogicalPlan.java ---
    @@ -1128,13 +1321,75 @@ public StreamMeta addStream(String id)
       public <T> StreamMeta addStream(String id, Operator.OutputPort<? extends T>
source, Operator.InputPort<? super T>... sinks)
       {
         StreamMeta s = addStream(id);
    -    s.setSource(source);
    -    for (Operator.InputPort<?> sink: sinks) {
    -      s.addSink(sink);
    +    id = s.id;
    +    ArrayListMultimap<Operator.OutputPort<?>, Operator.InputPort<?>>
streamMap = ArrayListMultimap.create();
    +    if (!(source instanceof ProxyOutputPort)) {
    +      s.setSource(source);
    +    }
    +    for (Operator.InputPort<?> sink : sinks) {
    +      if (source instanceof ProxyOutputPort || sink instanceof ProxyInputPort) {
    +        streamMap.put(source, sink);
    +        streamLinks.put(id, streamMap);
    +      } else {
    +        if (s.getSource() == null) {
    +          s.setSource(source);
    +        }
    +        s.addSink(sink);
    +      }
         }
         return s;
       }
     
    +  /**
    +   * This will be called once the Logical Dag is expanded, and the proxy input and proxt
output ports are populated with the actual ports that they refer to
    +   * This method adds sources and sinks for the StreamMeta objects which were left empty
in the addStream call.
    +   */
    +  public void applyStreamLinks()
    +  {
    +    for (String id : streamLinks.keySet()) {
    +      StreamMeta s = getStream(id);
    +      for (Map.Entry<Operator.OutputPort<?>, Operator.InputPort<?>>
pair : streamLinks.get(id).entries()) {
    +        if (s.getSource() == null) {
    +          Operator.OutputPort<?> outputPort = pair.getKey();
    +          while (outputPort instanceof ProxyOutputPort) {
    +            outputPort = ((ProxyOutputPort)outputPort).get();
    +          }
    +          s.setSource(outputPort);
    +        }
    +
    +        Operator.InputPort<?> inputPort = pair.getValue();
    +        while (inputPort instanceof ProxyInputPort) {
    +          inputPort = ((ProxyInputPort)inputPort).get();
    --- End diff --
    
    Was this taken care of?


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