A database system may include a relational database and multiple engines that are used to query the relational database. For example, the engines may include a structured query language (SQL) engine configured to query the relational database using standard SQL, and a calculation engine configured to query the relational database based on a calculation model. There may be benefits for using one type of engine over another type of engine. For example, the calculation model is a solution to express complex data flows and calculations within the database system. The calculation model is expressed in a format that allows non-relational operations and/or relatively more complex operations that are generally not possible with standard SQL. However, the SQL engine may be better suited for other types of operations such as join re-ordering or other relational operations. Both the calculation engine and the SQL engine are associated with their own optimizer. For example, the calculation engine's optimizer may be focused on filter push down, filter combination, attribute removal, etc., while the SQL engine's optimizer may be focused on relational optimizations.
Conventionally, the calculation models are not integrated with the execution model of the SQL optimizer. For example, if the query relates to a join involving a row store view and a calculation view, the SQL engine parses, compiles, and executes the SQL query for the row store view. After execution of the row store query, the query engine instantiates, optimizes, and then executes the calculation model for the calculation view, which is then combined with the row store view.