进入spark-shell
方式1: /home/mr/spark/bin/spark-shell (--master spark://$(echo `hostname`):7077 --executor-memory 5G --total-executor-cores 3 sqlContext.sql("use zxvmax") sqlContext.sql("select count(1) from t252_table_nsn where p_provincecode=510000 and p_date='2017-03-06' and p_hour=12").show()
方式2: val hc = new org.apache.spark.sql.hive.HiveContext(sc) hc.sql("use zxvmax").show
hc..sql("select count(1) from t252_table_nsn where p_provincecode=510000 and p_date='2017-03-06' and p_hour=12").show(100)
浙公网安备 33010602011771号