| 1934 | } |
| 1935 | |
| 1936 | pub fn join( |
| 1937 | self, |
| 1938 | mut right: HirRelationExpr, |
| 1939 | on: HirScalarExpr, |
| 1940 | kind: JoinKind, |
| 1941 | ) -> HirRelationExpr { |
| 1942 | if self.is_join_identity() |
| 1943 | && !right.is_correlated() |
| 1944 | && on == HirScalarExpr::literal_true() |
| 1945 | && kind.can_elide_identity_left_join() |
| 1946 | { |
| 1947 | // The join can be elided, but we need to adjust column references |
| 1948 | // on the right-hand side to account for the removal of the scope |
| 1949 | // introduced by the join. |
| 1950 | #[allow(deprecated)] |
| 1951 | right.visit_columns_mut(0, &mut |depth, col| { |
| 1952 | if col.level > depth { |
| 1953 | col.level -= 1; |
| 1954 | } |
| 1955 | }); |
| 1956 | right |
| 1957 | } else if right.is_join_identity() |
| 1958 | && on == HirScalarExpr::literal_true() |
| 1959 | && kind.can_elide_identity_right_join() |
| 1960 | { |
| 1961 | self |
| 1962 | } else { |
| 1963 | HirRelationExpr::Join { |
| 1964 | left: Box::new(self), |
| 1965 | right: Box::new(right), |
| 1966 | on, |
| 1967 | kind, |
| 1968 | } |
| 1969 | } |
| 1970 | } |
| 1971 | |
| 1972 | pub fn take(&mut self) -> HirRelationExpr { |
| 1973 | mem::replace( |