from pyspark import SparkConf, SparkContext
from pyspark.sql import HiveContext



def test():

        conf = SparkConf().setAppName("My App")
        sc = SparkContext(conf = conf)
        hive_context = HiveContext(sc)
        hive_context.sql(''' select device["device_type"] from online.tl_hdfs_maidian_view 
        where partition_date = '20181012' and action = "page_view" 
        and params["page_name"] = "diary_detail" and params["referrer"] = "home" limit 10 ''').show(6)


if __name__ == '__main__':
        test()
