Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
8d4380f4
Commit
8d4380f4
authored
Aug 02, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
84c23852
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
ctr-56.py
ctr-56.py
+15
-7
test.py
tensnsorflow/test.py
+7
-7
No files found.
ctr-56.py
View file @
8d4380f4
...
...
@@ -89,11 +89,19 @@ def rate2file():
f
.
write
(
line
)
def
get_time
():
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select dur_time from cost_time"
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
result
))
db
.
close
()
return
df
if
__name__
==
"__main__"
:
DIRECTORY_PATH
=
"/data/ffm/"
date
=
get_yesterday_date
()
black
=
get_black_user
()
device_id
=
get_data
()
temp_data
=
ctr
()
data
=
ctr_all
()
rate2file
()
DIRECTORY_PATH
=
"/home/gmuser/"
df
=
get_time
()
df
.
to_csv
(
DIRECTORY_PATH
+
"hello.csv"
,
index
=
None
)
tensnsorflow/test.py
View file @
8d4380f4
...
...
@@ -13,8 +13,8 @@ def test():
conf
=
SparkConf
()
.
setAppName
(
"My App"
)
.
set
(
"spark.io.compression.codec"
,
"lzf"
)
sc
=
SparkContext
(
conf
=
conf
)
spark
=
SparkSession
.
builder
.
enableHiveSupport
()
.
getOrCreate
()
#
ti = pti.TiContext(spark)
#
ti.tidbMapDatabase("jerry_test")
ti
=
pti
.
TiContext
(
spark
)
ti
.
tidbMapDatabase
(
"jerry_test"
)
spark
=
SparkSession
.
builder
.
appName
(
"hello test"
)
.
enableHiveSupport
()
.
getOrCreate
()
...
...
@@ -24,11 +24,11 @@ def test():
spark
.
sql
(
"CREATE TEMPORARY FUNCTION json_map AS 'brickhouse.udf.json.JsonMapUDF'"
)
spark
.
sql
(
"CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJsonFormatCheck'"
)
# hive_context.sql("SET mapreduce.job.queuename=data")
# hive_context.sql("SET mapred.input.dir.recursive=true")
# hive_context.sql("SET hive.mapred.supports.subdirectories=true")
sql
=
"select user_id from online.tl_hdfs_maidian_view where partition_date = '20190412' limit 10
"
spark
.
sql
(
sql
)
.
show
(
6
)
sql
=
"""select cl_id as device_id,params["business_id"] as cid_id,
(params["out"]-params["in"]) as dur_time from online.bl_hdfs_maidian_updates where action="page_view"
and params["page_name"]="diary_detail" and partition_date = '20190801'
""
"
df
=
spark
.
sql
(
sql
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment