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

Code generation

Finally, things can be improved even more, since Apache Spark runs on the Java Virtual Machine (JVM), which allows byte code to be created and modified during runtime. Let's consider an addition of values a and b, resulting in the expression a+b. Normally, this expression had to be interpreted by the JVM for each row of the Dataset. It would be nice if we could generate the JVM ByteCode for this expression on the fly. This is possible, and Catalyst makes use of a very cool Scala feature called Quasiquotes, which basically allows an arbitrary string containing Scala code to be compiled into ByteCode on the fly, if it starts with q. So for example, q"row.get($a)+row.get($b)" will tell the Scala compiler to use this String to generate further JVM byte code. This way, less code has to be interpreted, which speeds things up.

主站蜘蛛池模板: 天柱县| 海伦市| 锡林浩特市| 南康市| 金山区| 三门县| 聊城市| 荥经县| 临桂县| 隆子县| 伊金霍洛旗| 银川市| 那坡县| 舟曲县| 高碑店市| 荆门市| 偃师市| 遂溪县| 余庆县| 焉耆| 大连市| 乳山市| 迁西县| 大方县| 宁武县| 廉江市| 界首市| 湾仔区| 贵溪市| 双峰县| 高雄市| 博客| 桦川县| 定陶县| 应用必备| 信阳市| 乐业县| 商水县| 吉安县| 玉田县| 阿瓦提县|