Commit 7c7f78a5 authored by 张彦钊's avatar 张彦钊

增加hive代码

parent 22cada65
...@@ -80,8 +80,7 @@ def hive(): ...@@ -80,8 +80,7 @@ def hive():
conf = SparkConf().setMaster("spark://10.31.242.83:7077").setAppName("My app") conf = SparkConf().setMaster("spark://10.31.242.83:7077").setAppName("My app")
sc = SparkContext(conf=conf) sc = SparkContext(conf=conf)
sqlContext = HiveContext(sc) sqlContext = HiveContext(sc)
sql = "select params['business_id'],device['device_id'] from online.tl_hdfs_maidian_view " \ sql = "select partition_date from online.tl_hdfs_maidian_view limit 10"
"where action = 'diarybook_detail_click_more_topic' limit 10;"
my_dataframe = sqlContext.sql(sql) my_dataframe = sqlContext.sql(sql)
my_dataframe.show(6) my_dataframe.show(6)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment