internal static ReadMapNode RenderMapNode(Workspace Home, int PartitionID, HScriptParser.Crudam_read_maprContext context) { // Get the data source // DataSet data = VisitorHelper.GetData(Home, context.full_table_name()); string alias = (context.K_AS() != null) ? context.IDENTIFIER().GetText() : data.Name; // Create a local heap to work off of // MemoryStruct local_heap = new MemoryStruct(true); // Create a record register // StaticRegister memory = new StaticRegister(null); // Create expression visitor // ExpressionVisitor exp_vis = new ExpressionVisitor(local_heap, Home, alias, data.Columns, memory); // Where clause // Predicate where = VisitorHelper.GetWhere(exp_vis, context.where_clause()); // Create a reader // RecordReader reader = data.OpenReader(where); // Get the declarations // if (context.crudam_declare_many() != null) { VisitorHelper.AllocateMemory(Home, local_heap, exp_vis, context.crudam_declare_many()); } // Get the map actions // ActionVisitor act_vis = new ActionVisitor(Home, local_heap, exp_vis); act_vis.IsAsync = true; TNode map = act_vis.ToNode(context.map_action().query_action()); // Get the reduce actions // act_vis = new ActionVisitor(Home, local_heap, exp_vis); act_vis.IsAsync = false; TNode red = act_vis.ToNode(context.reduce_action().query_action()); ReadMapNode node = new ReadMapNode(PartitionID, map, red, memory, where); return node; }