Hive Architecture
Figure 1 shows the major components of Hive and its interactions with Hadoop. As shown in that figure, the main components of Hive are:
UI – The user interface for users to submit queries and other operations to the system. As of 2011 the system had a command line interface and a web based GUI was being developed.
Driver – The component which receives the queries. This component implements the notion of session handles and provides execute and fetch APIs modeled on JDBC/ODBC interfaces.
Compiler – The component that parses the query, does semantic analysis on the different query blocks and query expressions and eventually generates an execution plan with the help of the table and partition metadata looked up from the metastore.
Metastore – The component that stores all the structure information of the various tables and partitions in the warehouse including column and column type information, the serializers and deserializers necessary to read and write data and the corresponding HDFS files where the data is stored.
Execution Engine – The component which executes the execution plan created by the compiler. The plan is a DAG of stages. The execution engine manages the dependencies between these different stages of the plan and executes these stages on the appropriate system components.
Figure 1 also shows how a typical query flows through the system. The UI calls the execute interface to the Driver (step 1 in Figure 1). The Driver creates a session handle for the query and sends the query to the compiler to generate an execution plan (step 2). The compiler gets the necessary metadata from the metastore (steps 3 and 4). This metadata is used to typecheck the expressions in the query tree as well as to prune partitions based on query predicates. The plan generated by the compiler (step 5) is a DAG of stages with each stage being either a map/reduce job, a metadata operation or an operation on HDFS. For map/reduce stages, the plan contains map operator trees (operator trees that are executed on the mappers) and a reduce operator tree (for operations that need reducers). The execution engine submits these stages to appropriate components (steps 6, 6.1, 6.2 and 6.3). In each task (mapper/reducer) the deserializer associated with the table or intermediate outputs is used to read the rows from HDFS files and these are passed through the associated operator tree. Once the output is generated, it is written to a temporary HDFS file though the serializer (this happens in the mapper in case the operation does not need a reduce). The temporary files are used to provide data to subsequent map/reduce stages of the plan. For DML operations the final temporary file is moved to the table's location. This scheme is used to ensure that dirty data is not read (file rename being an atomic operation in HDFS). For queries, the contents of the temporary file are read by the execution engine directly from HDFS as part of the fetch call from the Driver (steps 7, 8 and 9).
กลุ่มสถาปัตยกรรมรูปที่ 1 แสดงส่วนประกอบสำคัญของกลุ่มและการโต้ตอบกับอย่างไร Hadoop ดังแสดงในรูปที่ ส่วนประกอบหลักของกลุ่มคือ: UI – อินเทอร์เฟซผู้ใช้สำหรับผู้ใช้ส่งแบบสอบถามและดำเนินการอื่น ๆ ในระบบ 2554 ระบบมีอินเทอร์เฟซแบบบรรทัดคำสั่ง และมีการพัฒนา GUI ตามเว็บ โปรแกรมควบคุม – ส่วนประกอบซึ่งได้รับการสอบถาม ส่วนประกอบนี้ใช้แนวคิดของเซสชันจับ และให้ดำเนินการ และนำมาใช้ APIs จำลองบนอินเทอร์เฟซ JDBC/ODBC คอมไพเลอร์คอมโพเนนต์ที่วิเคราะห์แบบสอบถาม ไม่บล็อกอื่นสอบถามและนิพจน์แบบสอบถามวิเคราะห์ความหมาย และสร้างแผนการดำเนินการ โดยใช้ข้อมูลเมตาของตารางและพาร์ติชันที่หาจาก metastore ในที่สุด Metastore – ส่วนที่เก็บข้อมูลโครงสร้างของตารางและพาร์ติชันต่าง ๆ ในคลังสินค้ารวมถึงคอลัมน์ และคอลัมน์ชนิดข้อมูล serializers และ deserializers ที่จำเป็นในการอ่าน และเขียนข้อมูล และแฟ้ม HDFS ที่สอดคล้องกันที่เก็บข้อมูล เครื่องมือดำเนินการ – ส่วนประกอบซึ่งดำเนินการแผนปฏิบัติการที่สร้างขึ้น โดยคอมไพเลอร์ แผนพื้นที่ขั้นตอนได้ โปรแกรมการดำเนินการจัดการความสัมพันธ์ระหว่างขั้นตอนเหล่านี้แตกต่างกันของแผน และดำเนินการขั้นตอนเหล่านี้บนคอมโพเนนต์ระบบที่เหมาะสม Figure 1 also shows how a typical query flows through the system. The UI calls the execute interface to the Driver (step 1 in Figure 1). The Driver creates a session handle for the query and sends the query to the compiler to generate an execution plan (step 2). The compiler gets the necessary metadata from the metastore (steps 3 and 4). This metadata is used to typecheck the expressions in the query tree as well as to prune partitions based on query predicates. The plan generated by the compiler (step 5) is a DAG of stages with each stage being either a map/reduce job, a metadata operation or an operation on HDFS. For map/reduce stages, the plan contains map operator trees (operator trees that are executed on the mappers) and a reduce operator tree (for operations that need reducers). The execution engine submits these stages to appropriate components (steps 6, 6.1, 6.2 and 6.3). In each task (mapper/reducer) the deserializer associated with the table or intermediate outputs is used to read the rows from HDFS files and these are passed through the associated operator tree. Once the output is generated, it is written to a temporary HDFS file though the serializer (this happens in the mapper in case the operation does not need a reduce). The temporary files are used to provide data to subsequent map/reduce stages of the plan. For DML operations the final temporary file is moved to the table's location. This scheme is used to ensure that dirty data is not read (file rename being an atomic operation in HDFS). For queries, the contents of the temporary file are read by the execution engine directly from HDFS as part of the fetch call from the Driver (steps 7, 8 and 9).
การแปล กรุณารอสักครู่..
![](//thimg.ilovetranslation.com/pic/loading_3.gif?v=b9814dd30c1d7c59_8619)