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

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.

主站蜘蛛池模板: 比如县| 宁河县| 九江县| 仁怀市| 灵川县| 玛纳斯县| 湛江市| 滨海县| 呼伦贝尔市| 卓资县| 渑池县| 泗阳县| 吉安县| 绥阳县| 巫山县| 博野县| 盖州市| 南康市| 多伦县| 柳河县| 余庆县| 温州市| 舟曲县| 鹰潭市| 湘西| 武清区| 玉山县| 雅江县| 滦南县| 湘潭县| 遂溪县| 宾阳县| 北安市| 杭锦后旗| 景东| 长治县| 临猗县| 顺义区| 垫江县| 夏津县| 昌江|