当前位置:网站首页>HQL statement execution process
HQL statement execution process
2022-08-05 05:25:00 【value growth】
HQL statement execution process:
- Syntax parsing: Antlr defines the grammatical rules of SQL, completes SQL lexical, grammatical parsing, and converts SQL into an abstract syntax tree AST Tree;
- Semantic parsing: traverse the AST Tree and abstract the basic unit of query QueryBlock;
- Generate a logical execution plan: traverse QueryBlock and translate it into an execution operation tree OperatorTree;
- Optimize the logic execution plan: The logic layer optimizer performs OperatorTree transformation, merges unnecessary ReduceSinkOperators, and reduces the amount of shuffle data;
- Generate physical execution plan: traverse OperatorTree and translate into MapReduce tasks;
- Optimize the physical execution plan: The physical layer optimizer transforms MapReduce tasks to generate the final execution plan.
How is HQL resolved into MR job?
Hive uses Antlr to implement syntax parsing. According to the SQL parsing rules formulated by Antlr, complete the lexical/syntax parsing of SQL statements, and convert SQL into abstract syntax tree AST.
Traverse the AST to generate the basic query unit QueryBlock. QueryBlock is the most basic unit of SQL, including three parts: input source, calculation process, and output.
Traverse QueryBlock to generate OperatorTree. The MapReduce task finally generated by Hive consists of OperatorTree in both Map and Reduce phases.Operator is to complete a single specific operation in the Map phase or the Reduce phase.QueryBlock generates Operator Tree by traversing the attributes of the saved syntax of the QB and QBParseInfo objects generated in the previous process.
**Optimize OperatorTree.**Most logic layer optimizers achieve the purpose of reducing MapReduce Job and shuffle data volume by transforming OperatorTree and merging operators
OperatorTree generates MapReduce Job. Traverse OperatorTree and translate into MR tasks.
- Generate MoveTask for output table
- Depth-first traversal from one of the root nodes of OperatorTree down
- ReduceSinkOperator marks the boundaries of Map/Reduce, the boundaries between multiple jobs
- Traverse other root nodes and encounter JoinOperator to merge MapReduceTask
- Generate StatTask update metadata
- Sever the operator relationship between Map and Reduce
Optimize the task. Use the physical optimizer to optimize the MR task to generate the final execution task
[HIVE] sqlStatement converted into mapreduce - Mr.Ming2 - Blog Park
边栏推荐
- [Go through 7] Notes from the first section of the fully connected neural network video
- "Recursion" recursion concept and typical examples
- Reverse theory knowledge 4
- Opencv中,imag=cv2.cvtColor(imag,cv2.COLOR_BGR2GRAY) 报错:error:!_src.empty() in function ‘cv::cvtColor‘
- 2022 Hangzhou Electric Multi-School 1st Session 01
- Judgment statement _switch and case
- 【记一下1】2022年6月29日 哥和弟 双重痛苦
- 学习总结week3_1函数
- ESP32 485 Illuminance
- 【读书】长期更新
猜你喜欢
【过一下8】全连接神经网络 视频 笔记
Database experiment five backup and recovery
使用二维码解决固定资产管理的难题
第二讲 Linear Model 线性模型
OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
Lecture 2 Linear Model Linear Model
[cesium] element highlighting
2022 Hangzhou Electric Multi-School 1st Session 01
Using pip to install third-party libraries in Pycharm fails to install: "Non-zero exit code (2)" solution
LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
随机推荐
Lecture 5 Using pytorch to implement linear regression
[Go through 3] Convolution & Image Noise & Edge & Texture
2022杭电多校第一场01
day8字典作业
SQL(二) —— join窗口函数视图
【过一下8】全连接神经网络 视频 笔记
RL reinforcement learning summary (1)
[cesium] element highlighting
【Reading】Long-term update
【解码工具】Bitcoin的一些在线工具
What are the characteristics of the interface of the physical layer?What does each contain?
day10-字符串作业
The role of the range function
Using pip to install third-party libraries in Pycharm fails to install: "Non-zero exit code (2)" solution
软件设计 实验四 桥接模式实验
【过一下10】sklearn使用记录
学习总结week3_2函数进阶
Machine Learning (2) - Machine Learning Fundamentals
What field type of MySQL database table has the largest storage length?
周末作业-循环练习题(2)