官术网_书友最值得收藏!

The SQL abstract syntax tree

As explained earlier, it doesn't matter if you are using SQL, DataFrame, or Dataset, the Apache Spark SQL parser returns an abstract syntax tree. However, DataFrames or Datasets can be used as starting points. The result of all these methods is again a tree-based structure called ULEP. The following figure is an example of such an AST (abstract syntax tree) adding an attribute coming from a row in a table and two literals together:

So as you can see, at the bottom of the tree (those nodes are also called leaves since they don't have any further nodes connecting to them) we have two integer literals: one and two. On top we have an operation taking those two literals and adding them together. You should note that those literals could also be loaded from a persistent data store. The Add operation virtually turns into another literal (three in this case), which then again is used by another Add operation as one of its inputs. The other input labeled as Attribute(x) now takes the value of x of that particular relation and exposes it as materialized value to the Add operator. So in other words, this AST does nothing else than add the number three to each of the values in column x.

主站蜘蛛池模板: 怀宁县| 丰顺县| 邓州市| 霍邱县| 新巴尔虎左旗| 界首市| 道真| 郧西县| 运城市| 通江县| 克东县| 呈贡县| 阿荣旗| 东平县| 达孜县| 湛江市| 浦江县| 湟中县| 太仆寺旗| 阳高县| 乳山市| 芜湖县| 鹰潭市| 洪泽县| 蒙城县| 台前县| 九龙县| 怀柔区| 拉孜县| 武鸣县| 个旧市| 冷水江市| 兴宁市| 福清市| 岳西县| 行唐县| 乌鲁木齐县| 外汇| 高碑店市| 阿坝| 余干县|