ClickHouse源碼閱讀筆記(二)之Interpreter介紹


ClickHouse源碼閱讀筆記(二)之Interpreter介紹

Interpreter是不同查詢的接口層,所有SQL的執行都調用execute函數,該函數在IInterpreter類中為純虛函數,具體調用哪種executeQuery,由實例化對象來決定。

Interpreter相關的文件在dbms/src/Interpreters/目錄下。

IInterpreter類中的execute函數介紹如下:

/** For queries that return a result (SELECT and similar), sets in BlockIO a stream from which you can read this result. 

對於SELECT以及類似的需要返回結果的查詢請求,server端將結果放到BlockIO數據流中,client端從BlockIO數據流中讀取。
* For queries that receive data (INSERT), sets a thread in BlockIO where you can write data.

對於INSERT這類需要寫入數據的請求,在server端的BlockIO中創建線程,client端進行寫入。
* For queries that do not require data and return nothing, BlockIO will be empty.

對於既不需要寫入數據,也不需要返回結果的請求,BlockIO是空的。
*/
virtual BlockIO execute() = 0;

 

IInterpreter類的所有派生類 ,類圖如下所示,通過類的名字已能明確看出所處理請求的類型,這里不再贅述。

下一篇文章會對select查詢進行詳細介紹,未完待續。。。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM