Commit d5f8d3a9 authored by 张彦钊's avatar 张彦钊

修改预测集sql

parent 7f03848e
......@@ -136,7 +136,7 @@ def get_predict(date,value_map,app_list_map,level2_map):
"left join cid_type_top c on e.device_id = c.device_id " \
"left join cid_time_cut cut on e.cid_id = cut.cid " \
"left join device_app_list dl on e.device_id = dl.device_id " \
"left join diary_feat feat on e.cid_id = feat.diary_id limit 600"
"left join diary_feat feat on e.cid_id = feat.diary_id"
df = con_sql(db, sql)
df = df.rename(columns={0: "y", 1: "z", 2: "label", 3: "ucity_id", 4: "clevel2_id", 5: "ccity_name",
6: "device_type", 7: "manufacturer", 8: "channel", 9: "top",
......
import datetime
# from pyspark.sql import HiveContext
# from pyspark.context import SparkContext
# from pyspark.conf import SparkConf
# from pyspark.sql import SQLContext
# from pyspark.sql import SparkSession
from pyspark.sql import HiveContext
from pyspark.context import SparkContext
from pyspark.conf import SparkConf
from pyspark.sql import SQLContext
from pyspark.sql import SparkSession
# from py4j.java_gateway import java_import
# import pytispark.pytispark as pti
import pandas as pd
......@@ -26,12 +26,12 @@ def con_sql(db,sql):
# def test():
# conf = SparkConf().setAppName("My App").set("spark.io.compression.codec", "lzf")
# 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)
conf = SparkConf().setAppName("My App").set("spark.io.compression.codec", "lzf")
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)
# def esmm_pre():
......
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