diff --git a/dot_file/createtable.dot b/dot_file/createtable.dot new file mode 100644 index 0000000..849bf44 --- /dev/null +++ b/dot_file/createtable.dot @@ -0,0 +1,11 @@ +digraph "query block" +{ +node[fontname="FangSong" shape= box]; +edge[fontname="FangSong"]; +graph[fontname="FangSong" rankdir = "LR"]; + + +a [ label = ""]; + + +} \ No newline at end of file diff --git a/dot_file/createtable.dot.png b/dot_file/createtable.dot.png new file mode 100644 index 0000000..eeeea08 Binary files /dev/null and b/dot_file/createtable.dot.png differ diff --git a/dot_file/dophase_select.dot b/dot_file/dophase_select.dot new file mode 100644 index 0000000..c18e597 --- /dev/null +++ b/dot_file/dophase_select.dot @@ -0,0 +1,90 @@ +digraph "dophase1.select" +{ +node[fontname="FangSong" shape= box]; +edge[fontname="FangSong"]; +graph[fontname="FangSong" rankdir = "LR"]; + +subgraph cluster_all{ + +qb [ label = " query block | { 名字 | 解释}| { numJoins | 连接数}| { numGbys | }| { numSels | select从句数量}| { numSelDi | select distinct 从句数量}| { aliasToTabs |表别名映射表}| { aliasToSubq |子查询别名映射表}| { aliasToProps |属性别名映射表}| { aliases |别名列表}| { qbp |解析信息结构}| { qbm |元信息结构}| { qbjoin |连接树}| { id | id}| { isQuery |是否查询}| { isAnalyzeRewrite | 是否分析重写}| { tblDesc |表描述}| { localDirectoryDesc |本地目录描述 }|{ ptfNodeToSpec |}|{ destToWindowingSpec |目标列区对应的窗口描述}" shape = "record" ]; + +qbp [label = "查询块解析信息|{ isSubQ |是否子查询}| { alias |别名}| { joinExpr |连接表达式对应\n的抽象语法树节点}| { hints |提示对应的抽象\n语法树节点}| { aliasToSrc |}| { nameToDest |}| { nameToSample |}| { exprToColumnAlias |别名节点与别名映射关系}| { destToSelExpr | 目标对应的selct从句}| { destToWhereExpr |}| { destToGroupby |}| { destRollups |}| { destCubes |}| { destGroupingSets |}| { destToHaving |}| { insertIntoTables |}| { isAnalyzeCommand |是否分析命令 }| { isInsertToTable |是否插入表格}| { isNoScanAnalyzeCommand |是否非扫描分析命令}| { isPartialScanAnalyzeCommand |是否部分扫描分析命令}| { tableSpecs | }| { tableName |}| { colName |列名列表 }| { colType |列类型列表}| { partName | }| { isTblLvl | }| { destToClusterby |}| { destToDistributeby |}| { destToSortby |}| { aliasToLateralViews |}| { destToLateralView |}| { destToOrderby |}| { destToLimit |}| { outerQueryLimit |}| { destToAggregationExprs | 目标到聚集函数的映射}| { destToDistinctFuncExprs | 目标与distinct的映射关系}| { destToWindowingExprs | 目标对应的窗口处理描述类}" shape=record]; +qbm [label = "{ aliasToTable |表别名映射表}| { nameToDestTable |目标表名字映射表}| { nameToDestPartition |目标分区名字映射表}| { nameToDestFile |目标文件名字映射表}| { nameToDestType |目标类型名字映射表}| { aliasToPartSpec |}| { aliasToDPCtx |动态分区上下文别名映射表}" shape=record]; + +tbldesc [label ="{ databaseName |数据库名}|{ tableName |表名}|{ isExternal |是否外部表}|{ cols |属性表}|{ partCols |分区属性表}|{ bucketCols |桶属性表}|{ sortCols |排序属性表}|{ numBuckets |桶数量}|{ fieldDelim |属性分隔符}|{ fieldEscape |属性转义}|{ collItemDelim |}|{ mapKeyDelim |}|{ lineDelim |行分隔符}|{ comment |注释}|{ inputFormat |输入格式}|{ outputFormat |输出格式}|{ location |位置}|{ serName |系列化名字}|{ storageHandler |存储处理}|{ serdeProps |序列化凡序列化属性映射表}|{ tblProps |表属性映射表}|{ ifNotExists |是否存在标志}|{ skewedColNames |}|{ skewedColValues |}|{ isStoredAsSubDirectories |}" shape=record]; + + +aliasToTabs[ label = " aliasToTabs |{别名|表格}|{|}" shape=record]; +aliasToSubq[ label = " aliasToSubq |{别名|子查询}|{|}" shape=record]; +aliasToProps[ label = " aliasToProps |{别名|属性}|{|}" shape=record]; +aliases[ label = " aliases |别名1|别名1|..." shape=record]; + +qb:aliasToTabsDesc->aliasToTabs; +qb:aliasToSubqDesc->aliasToSubq; +qb:aliasToPropsDesc->aliasToProps; +qb:aliasesDesc->aliases; +qbp->qb:qbp[dir=back]; +qb:qbmDesc->qbm; +qb:qbjoinDesc->"连接树"; +qb:tblDescDesc->tbldesc; +qb:localDirectoryDescDesc->tbldesc; + + +//////////// + +subgraph cluster_a{ + label="dophase1处理TOK_SELECT TOK_SELECTDI"; + color=grey; + + + select_step1 [label="\N 设置select从句对应的节点"]; + + subgraph cluster_aa1{ + label="doPhase1GetAggregationsFromSelect"; + + subgraph cluster_aaa1{ + label = "doPhase1GetAllAggregations"; + select_step2 [label="\N 对所传入的每一个节点\n递归找出聚集语句和窗口语句\n同时消除重复聚集语句"]; + } + select_step3 [label="\N 处理基于窗口的聚集函数"]; + } + select_step4 [label="\N doPhase1GetColumnAliasesFromSelect\n寻找列别名并设置树节点与列别名对应关系"]; + select_step5 [label="\N 设置目标与聚集表达式关系\n寻找出distinct节点后\n设置目标与distinct函数关系"]; + + +} + +edge[color=red]; + +select_step1 -> qb:numSels[label="select_step1-1 "]; +select_step1 -> qb:numSelDi[label="select_step1-2 "]; +select_step1 -> qbp:destToSelExpr[label="select_step1-3 "]; +select_step1 -> qbp:hints[label="select_step1-4"]; + +select_step3 -> qb:destToWindowingSpec[label="select_step3-1 "]; +select_step3 -> qbp:destToWindowingExprs[label="select_step3-2 "]; + +select_step4 -> qbp:exprToColumnAlias[label="select_step4-1 "]; + +select_step5 -> qbp:destToAggregationExprs[label="select_step5-1 "]; +select_step5 -> qbp:destToDistinctFuncExprs[label="select_step5-2 "]; + + +} + + +edge[color=black]; + select_step1 -> select_step2 -> select_step3 -> select_step4 -> select_step5; + //select_step1 -> select_step2 -> select_step3 -> select_step4 -> select_step5[constraint=false weight=0]; + select_step1 -> select_step2 [constraint=false weight=1]; + select_step2 -> select_step3 [constraint=false weight=2]; + select_step3 -> select_step4 [constraint=false weight=3]; + select_step4 -> select_step5 [constraint=false weight=4 ]; + + +//{rank=same;select_step1;select_step2;select_step3;select_step4;select_step5;} +//{rankdir=TB;rank=same;select_step1;select_step2;select_step3;select_step4;select_step5;} + +} + + diff --git a/dot_file/dophase_select.dot.png b/dot_file/dophase_select.dot.png new file mode 100644 index 0000000..e14719c Binary files /dev/null and b/dot_file/dophase_select.dot.png differ diff --git a/dot_file/processWindowFunction.dot b/dot_file/processWindowFunction.dot new file mode 100644 index 0000000..77df929 --- /dev/null +++ b/dot_file/processWindowFunction.dot @@ -0,0 +1,47 @@ +digraph "processwindowFunction" +{ +node[fontname="FangSong" shape= box]; +edge[fontname="FangSong"]; +graph[fontname="FangSong" rankdir = "LR"]; + +subgraph cluster_all{ +label="用以描述窗口函数处理的结构"; + + + + +WindowingSpec[label="WindowingSpec\n在一个特定的查询内的window处理的描述类 |{ aliasToWdwExpr | 别名与窗口表达式的映射表} |{ windowSpecs | 窗口名与窗口对象描述类映射表 } |{ windowExpressions | 窗口表达式列表} " shape = record]; + +aliasToWdwExpr[label="哈希表\n别名与窗口表达式的映射表 |{别名|窗口表达式}|{ | } |{ | }" shape = record]; + +WindowExpressionSpec[label="WindowExpressionSpec\n描述分窗口时上下文中的select语句 |{ alias | 别名 } | { expression | 抽象树形式的表达式} " shape = record]; + +windowSpecs[label="哈希表\n窗口名与窗口对象描述类映射表 |{别名|窗口对象}|{ | } |{ | }" shape = record]; + + + + +WindowFunctionSpec[label="WindowFunctionSpec\n窗口函数说明类|父类区域|{ alias | 别名} |{ expression | 表达式树} |本类区域|{ name | 名字 } |{ isStar | 参数为*} |{ isDistinct | distinct修饰} |{ args | 参数列表} |{ windowSpec | 窗口声明} " shape = record]; + +WindowSpec[label="WindowSpec\n窗口说明类|{ sourceId | 一个窗口可以通过名字引用源窗口\n这个记录源窗口id} |{ partitioning | 分区描述} |{ windowFrame | 窗口帧}" shape = record]; + +WindowFrameSpec[label="WindowFrameSpec\n窗口帧类\n只用来声明当前行的窗口可见的范围|{ start | } |{ end | } " shape = record]; + +PartitioningSpec[label="PartitioningSpec\n分区时描述类\n描述ptf函数的输入是如何分区和排序的 | { partSpec | ASTNode表达式的列表} |{ orderSpec | 升序降序枚举类的表达式的列表 } " shape = record]; + + +WindowingSpec:aliasToWdwExprDesc -> aliasToWdwExpr; +WindowingSpec:windowExpressionsDesc -> WindowExpressionSpec; +aliasToWdwExpr:WindowExpressionSpecDesc -> WindowExpressionSpec; + + +WindowingSpec:windowSpecsDesc ->windowSpecs; +windowSpecs:WindowSpecDesc ->WindowSpec; + + +WindowFunctionSpec:windowSpecDesc->WindowSpec; +WindowSpec:windowFrameDesc->WindowFrameSpec; +WindowSpec:partitioningDesc->PartitioningSpec; +} + +} \ No newline at end of file diff --git a/dot_file/processWindowFunction.dot.png b/dot_file/processWindowFunction.dot.png new file mode 100644 index 0000000..af2725c Binary files /dev/null and b/dot_file/processWindowFunction.dot.png differ diff --git a/dot_file/qb.dot b/dot_file/qb.dot new file mode 100644 index 0000000..e3be5a9 --- /dev/null +++ b/dot_file/qb.dot @@ -0,0 +1,33 @@ +digraph "query block" +{ +node[fontname="FangSong" shape= box]; +edge[fontname="FangSong"]; +graph[fontname="FangSong" rankdir = "LR"]; + + + +qb [ label = " query block | { 名字 | 解释}| { numJoins | 连接数}| { numGbys | }| { numSels | select从句数量}| { numSelDi | select distinct 从句数量}| { aliasToTabs |表别名映射表}| { aliasToSubq |子查询别名映射表}| { aliasToProps |属性别名映射表}| { aliases |别名列表}| { qbp |解析信息结构}| { qbm |元信息结构}| { qbjoin |连接树}| { id | id}| { isQuery |是否查询}| { isAnalyzeRewrite | 是否分析重写}| { tblDesc |表描述}| { localDirectoryDesc |本地目录描述 }|{ ptfNodeToSpec |}|{ destToWindowingSpec |目标列区对应的窗口描述}" shape = "record" ]; + +qbp [label = "查询块解析信息|{ isSubQ |是否子查询}| { alias |别名}| { joinExpr |连接表达式对应\n的抽象语法树节点}| { hints |提示对应的抽象\n语法树节点}| { aliasToSrc |}| { nameToDest |}| { nameToSample |}| { exprToColumnAlias |别名节点与别名映射关系}| { destToSelExpr | 目标对应的selct从句}| { destToWhereExpr |}| { destToGroupby |}| { destRollups |}| { destCubes |}| { destGroupingSets |}| { destToHaving |}| { insertIntoTables |}| { isAnalyzeCommand |是否分析命令 }| { isInsertToTable |是否插入表格}| { isNoScanAnalyzeCommand |是否非扫描分析命令}| { isPartialScanAnalyzeCommand |是否部分扫描分析命令}| { tableSpecs | }| { tableName |}| { colName |列名列表 }| { colType |列类型列表}| { partName | }| { isTblLvl | }| { destToClusterby |}| { destToDistributeby |}| { destToSortby |}| { aliasToLateralViews |}| { destToLateralView |}| { destToOrderby |}| { destToLimit |}| { outerQueryLimit |}| { destToAggregationExprs | 目标到聚集函数的映射}| { destToDistinctFuncExprs | 目标与distinct的映射关系}| { destToWindowingExprs | 目标对应的窗口处理描述类}" shape=record]; +qbm [label = "{ aliasToTable |表别名映射表}| { nameToDestTable |目标表名字映射表}| { nameToDestPartition |目标分区名字映射表}| { nameToDestFile |目标文件名字映射表}| { nameToDestType |目标类型名字映射表}| { aliasToPartSpec |}| { aliasToDPCtx |动态分区上下文别名映射表}" shape=record]; + +tbldesc [label ="{ databaseName |数据库名}|{ tableName |表名}|{ isExternal |是否外部表}|{ cols |属性表}|{ partCols |分区属性表}|{ bucketCols |桶属性表}|{ sortCols |排序属性表}|{ numBuckets |桶数量}|{ fieldDelim |属性分隔符}|{ fieldEscape |属性转义}|{ collItemDelim |}|{ mapKeyDelim |}|{ lineDelim |行分隔符}|{ comment |注释}|{ inputFormat |输入格式}|{ outputFormat |输出格式}|{ location |位置}|{ serName |系列化名字}|{ storageHandler |存储处理}|{ serdeProps |序列化凡序列化属性映射表}|{ tblProps |表属性映射表}|{ ifNotExists |是否存在标志}|{ skewedColNames |}|{ skewedColValues |}|{ isStoredAsSubDirectories |}" shape=record]; + + +aliasToTabs[ label = " aliasToTabs |{别名|表格}|{|}" shape=record]; +aliasToSubq[ label = " aliasToSubq |{别名|子查询}|{|}" shape=record]; +aliasToProps[ label = " aliasToProps |{别名|属性}|{|}" shape=record]; +aliases[ label = " aliases |别名1|别名1|..." shape=record]; + +qb:aliasToTabsDesc->aliasToTabs; +qb:aliasToSubqDesc->aliasToSubq; +qb:aliasToPropsDesc->aliasToProps; +qb:aliasesDesc->aliases; +qbp->qb:qbp[dir=back]; +qb:qbmDesc->qbm; +qb:qbjoinDesc->"连接树"; +qb:tblDescDesc->tbldesc; +qb:localDirectoryDescDesc->tbldesc; + + +} \ No newline at end of file diff --git a/dot_file/qb.dot.png b/dot_file/qb.dot.png new file mode 100644 index 0000000..83997fe Binary files /dev/null and b/dot_file/qb.dot.png differ diff --git a/dot_file/rundot.bat b/dot_file/rundot.bat index d204ce5..19ff07b 100644 --- a/dot_file/rundot.bat +++ b/dot_file/rundot.bat @@ -1,3 +1,5 @@ for /R %%s in (*.dot) do ( dot -Tpng -O %%s ) + +dophase_select.dot.png \ No newline at end of file diff --git a/dot_file/semantic.dot b/dot_file/semantic.dot index 46c461b..bb63ece 100644 --- a/dot_file/semantic.dot +++ b/dot_file/semantic.dot @@ -1,4 +1,4 @@ -digraph "Fast-forward" +digraph "semantic" { node[fontname="FangSong" shape= box]; edge[fontname="FangSong"];