sparkSQL--內建函式-位運算
阿新 • • 發佈:2020-08-16
[root@centos00 ~]$ cd /opt/cdh5.14.2/hadoop-2.6.0-cdh5.14.2/ [root@centos00 hadoop-2.6.0-cdh5.14.2]$ sbin/hadoop-daemon.sh start namenode [root@centos00 hadoop-2.6.0-cdh5.14.2]$ sbin/hadoop-daemon.sh start datanode [root@centos00 ~]$ cd /opt/cdh5.14.2/hive-1.1.0-cdh5.14.2/ [root@centos00 hive-1.1.0-cdh5.14.2]$ bin/hive --service metastore & [root@centos00 hadoop-2.6.0-cdh5.14.2]$ cd ../spark-2.2.1-cdh5.14.2/ [root@centos00 spark-2.2.1-cdh5.14.2]$ sbin/start-master.sh [root@centos00 spark-2.2.1-cdh5.14.2]$ sbin/start-slaves.sh [root@centos00 spark-2.2.1-cdh5.14.2]$ bin/spark-shell --master local[2] // expr1 ^ expr2 - Returns the result of bitwise exclusive OR of expr1 and expr2. scala> spark.sql("SELECT 3 ^ 5").show() +-------+ |(3 ^ 5)| +-------+ | 6| +-------+ // expr1 | expr2 - Returns the result of bitwise OR of expr1 and expr2. scala> spark.sql("SELECT 3 | 5").show() +-------+ |(3 | 5)| +-------+ | 7| +-------+ // ~ expr - Returns the result of bitwise NOT of expr. scala> spark.sql("SELECT ~ 0").show() +---+ | ~0| +---+ | -1| +---+