@@ -79,55 +79,6 @@ class InputSimpleRenumberVisitor : public hdk::ir::ExprRewriter {
79
79
const std::unordered_map<size_t , size_t >& old_to_new_idx_;
80
80
};
81
81
82
- class RebindInputsVisitor : public hdk ::ir::ExprRewriter {
83
- public:
84
- RebindInputsVisitor (const hdk::ir::Node* old_input, const hdk::ir::Node* new_input)
85
- : old_input_(old_input), new_input_(new_input) {}
86
-
87
- hdk::ir::ExprPtr visitColumnRef (const hdk::ir::ColumnRef* col_ref) override {
88
- if (col_ref->node () == old_input_) {
89
- return hdk::ir::makeExpr<hdk::ir::ColumnRef>(
90
- col_ref->type (), new_input_, col_ref->index ());
91
- }
92
- return ExprRewriter::visitColumnRef (col_ref);
93
- }
94
-
95
- void visitNode (const hdk::ir::Node* node) {
96
- if (dynamic_cast <const hdk::ir::Aggregate*>(node) ||
97
- dynamic_cast <const hdk::ir::Sort*>(node)) {
98
- return ;
99
- }
100
- if (auto join =
101
- const_cast <hdk::ir::Join*>(dynamic_cast <const hdk::ir::Join*>(node))) {
102
- if (join->getCondition ()) {
103
- auto cond = ExprRewriter::visit (join->getCondition ());
104
- join->setCondition (std::move (cond));
105
- }
106
- return ;
107
- }
108
- if (auto project =
109
- const_cast <hdk::ir::Project*>(dynamic_cast <const hdk::ir::Project*>(node))) {
110
- hdk::ir::ExprPtrVector new_exprs;
111
- for (auto & expr : project->getExprs ()) {
112
- new_exprs.push_back (ExprRewriter::visit (expr.get ()));
113
- }
114
- project->setExpressions (std::move (new_exprs));
115
- return ;
116
- }
117
- if (auto filter =
118
- const_cast <hdk::ir::Filter*>(dynamic_cast <const hdk::ir::Filter*>(node))) {
119
- auto cond = ExprRewriter::visit (filter->getConditionExpr ());
120
- filter->setCondition (std::move (cond));
121
- return ;
122
- }
123
- CHECK (false );
124
- }
125
-
126
- private:
127
- const hdk::ir::Node* old_input_;
128
- const hdk::ir::Node* new_input_;
129
- };
130
-
131
82
size_t get_actual_source_size (
132
83
const hdk::ir::Project* curr_project,
133
84
const std::unordered_set<const hdk::ir::Project*>& projects_to_remove) {
@@ -301,19 +252,14 @@ void redirect_inputs_of(
301
252
? std::dynamic_pointer_cast<const hdk::ir::Project>(node->getAndOwnInput (1 ))
302
253
: std::dynamic_pointer_cast<const hdk::ir::Project>(node->getAndOwnInput (0 ));
303
254
join->replaceInput (src_project, src_project->getAndOwnInput (0 ));
304
- RebindInputsVisitor rebinder (src_project.get (), src_project->getInput (0 ));
305
- auto usrs_it = du_web.find (join.get ());
306
- CHECK (usrs_it != du_web.end ());
307
- for (auto usr : usrs_it->second ) {
308
- rebinder.visitNode (usr);
309
- }
255
+ // Case when join users have to be adjusted is not expected.
256
+ CHECK (src_project != node->getAndOwnInput (0 ) ||
257
+ src_project->size () == src_project->getAndOwnInput (0 )->size ());
310
258
311
259
if (other_project && projects.count (other_project.get ())) {
312
260
join->replaceInput (other_project, other_project->getAndOwnInput (0 ));
313
- RebindInputsVisitor other_rebinder (other_project.get (), other_project->getInput (0 ));
314
- for (auto usr : usrs_it->second ) {
315
- other_rebinder.visitNode (usr);
316
- }
261
+ CHECK (other_project != node->getAndOwnInput (0 ) ||
262
+ other_project->size () == other_project->getAndOwnInput (0 )->size ());
317
263
}
318
264
return ;
319
265
}
@@ -1015,12 +961,6 @@ void try_insert_coalesceable_proj(
1015
961
auto project = project_owner.get ();
1016
962
1017
963
only_usr->replaceInput (node, project_owner);
1018
- if (dynamic_cast <const hdk::ir::Join*>(only_usr)) {
1019
- RebindInputsVisitor visitor (filter, project);
1020
- for (auto usr : du_web[only_usr]) {
1021
- visitor.visitNode (usr);
1022
- }
1023
- }
1024
964
1025
965
liveouts.insert (std::make_pair (project, outs));
1026
966
0 commit comments