An engine is responsible to compile SQL on the specific Catalog.
Summary
classhybridse::vm::Engine;
An engine is responsible to compile SQL on the specific Catalog.
An engine can be used to `compile sql and explain the compiling result. It maintains a LRU cache for compiling result.
Example
// Assuming the catalog has been created and initialized beforebase::Status status;EngineOptions options;Engineengine(catalog,options);BatchRunSession session;std::db ="test_db";std::string sql ="select col0, col1, col2, col1+col2 as col12 from t1;";engine.Get(sql, db, session, status);engine.Explain(sql, db,EngineMode::kBatchMode,&output,&status);
Compile sql in db and stored the results in the session.
function GetDependentTables
Search all tables related to the specific sql in db.
The tables' names are returned in tables
function Explain
Explain sql compiling result.
The results are returned as ExplainOutput in explain_output. The success or fail status message is returned as Status in status. TODO: base::Status* status -> base::Status& status
function Explain
Same as above, but allowing compiling with configuring common column indices.
The common column indices are used for common column optimization under EngineMode::kBatchRequestMode