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

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.

主站蜘蛛池模板: 北海市| 蒙自县| 育儿| 大悟县| 天祝| 陇西县| 田阳县| 蓬莱市| 建宁县| 乡宁县| 五指山市| 平邑县| 呼和浩特市| 吴桥县| 凤山县| 安国市| 曲阜市| 嘉义县| 正镶白旗| 璧山县| 普兰县| 松原市| 宜宾市| 图木舒克市| 定南县| 大关县| 南部县| 北流市| 溆浦县| 鹤峰县| 昌邑市| 二连浩特市| 太湖县| 通化县| 朝阳县| 长春市| 维西| 澄江县| 浏阳市| 彩票| 平凉市|