当前位置:网站首页>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
边栏推荐
- 【过一下11】随机森林和特征工程
- [Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)
- 【cesium】Load and locate 3D Tileset
- 2022牛客多校第四场C.Easy Counting Problem(EGF+NTT)
- Wise Force Deleter强制删除工具
- 第四讲 back propagation 反向传播
- coppercam primer [6]
- 学习总结week2_2
- uva1325
- Difference between for..in and for..of
猜你喜欢
随机推荐
Algorithms - ones and zeros (Kotlin)
OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
Flutter真机运行及模拟器运行
human weakness
RL reinforcement learning summary (1)
Qt produces 18 frames of Cupid to express his love, is it your Cupid!!!
使用二维码解决固定资产管理的难题
Do you use tomatoes to supervise your peers?Add my study room, come on together
The software design experiment four bridge model experiment
机器学习(一) —— 机器学习基础
【过一下7】全连接神经网络视频第一节的笔记
coppercam入门手册[6]
redis事务
coppercam primer [6]
类的底层机制
Flex layout frog game clearance strategy
Transformation 和 Action 常用算子
redis复制机制
redis 持久化
Analysis of Mvi Architecture









