17. A method comprising: transforming a first query, comprising a first lateral view that includes a first predicate that references a database object that is joined with the first lateral view, to a second query that includes: a second view without the first predicate that references the database object, wherein the database object is joined with the second view, and a second predicate outside the second view, wherein the second predicate corresponds to the first predicate, wherein the second predicate references the second view, and wherein the second query is semantically equivalent to the first query; generating an execution plan for executing the second query instead of the first query; wherein the method is performed by one or more computing devices.
17. A method comprising: transforming a first query, comprising a first lateral view that includes a first predicate that references a database object that is joined with the first lateral view, to a second query that includes: a second view without the first predicate that references the database object, wherein the database object is joined with the second view, and a second predicate outside the second view, wherein the second predicate corresponds to the first predicate, wherein the second predicate references the second view, and wherein the second query is semantically equivalent to the first query; generating an execution plan for executing the second query instead of the first query; wherein the method is performed by one or more computing devices. 21. The method of claim 17 , wherein the first lateral view is an outer joined or a non-outer joined lateral view that references an aggregation function, wherein the second view is an outer joined non-lateral view, and wherein the second view includes a GROUP BY clause that preserves, after the first predicate has been pulled out of the first lateral view, an interaction that was present between the aggregation function and the first predicate when the first predicate was in the first lateral view.