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

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.

主站蜘蛛池模板: 都兰县| 尚义县| 樟树市| 白山市| 荣成市| 镇雄县| 西盟| 银川市| 宁明县| 泌阳县| 兰考县| 汝南县| 芮城县| 赤水市| 阳原县| 桑植县| 巴林左旗| 高邑县| 安龙县| 海淀区| 肥东县| 中方县| 汉川市| 池州市| 古田县| 桦川县| 定西市| 广西| 年辖:市辖区| 南宁市| 三原县| 张家界市| 平远县| 咸宁市| 北辰区| 冕宁县| 宝应县| 黔南| 义马市| 吉隆县| 连城县|