@@ -1767,17 +1767,16 @@ DerivedTableP ToGraph::makeQueryGraph(
17671767 return nullptr ;
17681768 }
17691769 case lp::NodeKind::kFilter : {
1770+ const auto & input = *node.onlyInput ();
17701771 const auto & filter = *node.asUnchecked <lp::FilterNode>();
1771- if (!isNondeterministicWrap_ && hasNondeterministic (filter.predicate ())) {
1772- auto * outerDt = makeStream (*node. onlyInput (), allowedInDt );
1772+ if (hasNondeterministic (filter.predicate ())) {
1773+ auto * outerDt = makeStream (input, 0 );
17731774 addFilter (filter);
17741775 finalizeDt (node, outerDt);
1775- isNondeterministicWrap_ = true ;
17761776 return nullptr ;
17771777 }
1778- isNondeterministicWrap_ = false ;
1779- auto * outerDt = makeStream (*node.onlyInput (), allowedInDt);
1780- addFilter (*node.asUnchecked <lp::FilterNode>());
1778+ auto * outerDt = makeStream (input, allowedInDt);
1779+ addFilter (filter);
17811780 return outerDt;
17821781 }
17831782 case lp::NodeKind::kProject : {
@@ -1805,11 +1804,7 @@ DerivedTableP ToGraph::makeQueryGraph(
18051804 if (auto * outerDt = makeUnordered (*join.left (), allowedInDt)) {
18061805 finalizeDt (*join.left (), outerDt);
18071806 }
1808- if (isNondeterministicWrap_) {
1809- allowedInDt = 0 ;
1810- isNondeterministicWrap_ = false ;
1811- } else if (
1812- join.joinType () != lp::JoinType::kInner ||
1807+ if (join.joinType () != lp::JoinType::kInner ||
18131808 queryCtx ()->optimization ()->options ().syntacticJoinOrder ) {
18141809 allowedInDt = makeDtIf (allowedInDt, lp::NodeKind::kJoin );
18151810 }
0 commit comments