Esempio n. 1
0
 private DryadQueryNode VisitAggregate(QueryNodeInfo source,
                                       Expression seed,
                                       LambdaExpression funcLambda,
                                       LambdaExpression resultLambda,
                                       bool isQuery,
                                       Expression queryExpr)
 {
     DryadQueryNode child = this.Visit(source);
     DryadQueryNode resNode = child;
     if (HpcLinqExpression.IsAssociative(funcLambda))
     {
         LambdaExpression combinerLambda = HpcLinqExpression.GetAssociativeCombiner(funcLambda);
         ResourceAttribute attrib = AttributeSystem.GetResourceAttrib(funcLambda);
         bool funcIsExpensive = (attrib != null && attrib.IsExpensive);
         resNode = this.PromoteConcat(
                           source, child,
                           delegate(DryadQueryNode x) {
                               DryadQueryNode y = new DryadAggregateNode("AssocAggregate", seed,
                                                                         funcLambda, combinerLambda, resultLambda,
                                                                         1, isQuery, queryExpr, x, false);
                               return new DryadAggregateNode("AssocTreeAggregate", seed,
                                                             funcLambda, combinerLambda, resultLambda,
                                                             2, isQuery, queryExpr, y, false);
                           });
         resNode = new DryadAggregateNode("AssocAggregate", seed, funcLambda, combinerLambda, resultLambda,
                                          3, isQuery, queryExpr, resNode, funcIsExpensive);
     }
     else
     {
         resNode = new DryadAggregateNode("Aggregate", seed, funcLambda, null, resultLambda, 3,
                                          isQuery, queryExpr, child, false);
     }
     return resNode;
 }
Esempio n. 2
0
 internal virtual string Visit(DryadAggregateNode node,
                               CodeMemberMethod vertexMethod,
                               string[] readerNames,
                               string[] writerNames)
 {
     return node.AddVertexCode(vertexMethod, readerNames, writerNames);
 }