Introduction to Interpreter of ClickHouse source code reading notes (2)

Introduction to Interpreter of ClickHouse source code reading notes (2)

Interpreter is the interface layer for different queries. All SQL executions call the execute function. This function is a pure virtual function in the IInterpreter class. The specific executeQuery to be called depends on the instantiated object.

Interpreter related files are in the dbms / src / Interpreters / directory.

The execute function in the IInterpreter class is introduced as follows:

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

For SELECT and similar query requests that need to return results, the server side places the results in the BlockIO data stream, and the client side reads from the BlockIO data stream.
* For queries that receive data (INSERT), sets a thread in BlockIO where you can write data.

For requests such as INSERT that need to write data, create a thread in BlockIO on the server side and write on the client side.
* For queries that do not require data and return nothing, BlockIO will be empty.

For requests that do not need to write data or return results, BlockIO is empty.
* /
virtual BlockIO execute () = 0;

 

All derived classes of the IInterpreter class, the class diagram is shown below, the type of request processed can be clearly seen through the name of the class, and will not be repeated here.

The next article will introduce the select query in detail, which will be continued. . .

Guess you like

Origin www.cnblogs.com/snake-fly/p/12710119.html