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

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.

主站蜘蛛池模板: 星子县| 灵宝市| 正定县| 开封县| 汽车| 清苑县| 土默特左旗| 高尔夫| 鄂伦春自治旗| 时尚| 无极县| 武冈市| 德令哈市| 梁山县| 凤城市| 鸡西市| 汶川县| 塔河县| 朝阳县| 乡城县| 屏边| 赤壁市| 鄂托克旗| 彝良县| 富阳市| 肥西县| 吉安县| 罗定市| 衡阳县| 江源县| 家居| 荣成市| 关岭| 惠来县| 抚顺县| 嘉鱼县| 孟连| 大英县| 广德县| 灵武市| 正镶白旗|