Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppTag
Project
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
AppTag
Commits
14d29c6e
Commit
14d29c6e
authored
Aug 07, 2019
by
jinfeng.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a595d449
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
76 deletions
+3
-76
mysql2hive.sh
azkaban/mysql2hive.sh
+1
-1
pom.xml
pom.xml
+2
-0
GetPackageFromMongo.java
...n/java/com/mobvista/apptag/utils/GetPackageFromMongo.java
+0
-75
No files found.
azkaban/mysql2hive.sh
View file @
14d29c6e
...
@@ -23,7 +23,7 @@ sql="INSERT OVERWRITE DIRECTORY '${base_dir}/${date_path}'
...
@@ -23,7 +23,7 @@ sql="INSERT OVERWRITE DIRECTORY '${base_dir}/${date_path}'
LATERAL VIEW EXPLODE(SPLIT(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING(category,2,LENGTH(category) - 2),'
\"
',''),' ',''),',')) featTable AS feat_id) a
LATERAL VIEW EXPLODE(SPLIT(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING(category,2,LENGTH(category) - 2),'
\"
',''),' ',''),',')) featTable AS feat_id) a
INNER JOIN dwh.dm_old2new_tag b ON a.feat_id = b.new_second_id
INNER JOIN dwh.dm_old2new_tag b ON a.feat_id = b.new_second_id
UNION ALL
UNION ALL
SELECT c.package_name,c.platform,c.tag_type,c.first_tag,c.second_tag,c
,
comment
SELECT c.package_name,c.platform,c.tag_type,c.first_tag,c.second_tag,c
.
comment
FROM dwh.dim_package_tags c LEFT JOIN dev.app_tag d ON LOWER(c.package_name) = LOWER(d.package_name)
FROM dwh.dim_package_tags c LEFT JOIN dev.app_tag d ON LOWER(c.package_name) = LOWER(d.package_name)
WHERE d.package_name IS NULL
WHERE d.package_name IS NULL
) package_tags
) package_tags
...
...
pom.xml
View file @
14d29c6e
...
@@ -93,11 +93,13 @@
...
@@ -93,11 +93,13 @@
<artifactId>
spring-aspects
</artifactId>
<artifactId>
spring-aspects
</artifactId>
<version>
5.1.2.RELEASE
</version>
<version>
5.1.2.RELEASE
</version>
</dependency>
</dependency>
<!--
<dependency>
<dependency>
<groupId>org.mongodb</groupId>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<artifactId>mongo-java-driver</artifactId>
<version>3.10.2</version>
<version>3.10.2</version>
</dependency>
</dependency>
-->
<dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<artifactId>
gson
</artifactId>
...
...
src/main/java/com/mobvista/apptag/utils/GetPackageFromMongo.java
deleted
100644 → 0
View file @
a595d449
package
com
.
mobvista
.
apptag
.
utils
;
import
com.mongodb.MongoClientSettings
;
import
com.mongodb.ReadPreference
;
import
com.mongodb.ServerAddress
;
import
com.mongodb.client.*
;
import
com.mongodb.client.model.Filters
;
import
org.apache.commons.lang3.StringUtils
;
import
org.bson.Document
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* @package: com.mobvista.apptag.utils
* @author: wangjf
* @date: 2019-07-17
* @time: 11:38
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public
class
GetPackageFromMongo
{
public
static
void
main
(
String
[]
args
)
{
try
{
String
mongoUrl
=
"internal-beijing-adServerMongo-virginia-1390640500.us-east-1.elb.amazonaws.com"
;
Date
date
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
dt
=
sdf
.
parse
(
sdf
.
format
(
date
));
Calendar
rightNow
=
Calendar
.
getInstance
();
rightNow
.
setTime
(
dt
);
rightNow
.
add
(
Calendar
.
DAY_OF_YEAR
,
-
30
);
// MongoClientOptions.Builder builder = new MongoClientOptions.Builder()
MongoClientSettings
settings
=
MongoClientSettings
.
builder
()
.
retryWrites
(
true
)
.
applyToConnectionPoolSettings
(
builder
->
builder
.
maxConnectionIdleTime
(
6000
,
TimeUnit
.
MILLISECONDS
))
.
applyToClusterSettings
(
builder
->
{
builder
.
hosts
(
Arrays
.
asList
(
new
ServerAddress
(
mongoUrl
,
27017
)));
}).
build
();
// MongoClient mongoClient = new MongoClient(new ServerAddress("server ip",27017), Arrays.asList(credential2),opts);
// 连接到 mongodb 服务
MongoClient
mongoClient
=
MongoClients
.
create
(
settings
);
// 连接到数据库
MongoDatabase
mongoDatabase
=
mongoClient
.
getDatabase
(
"new_adn"
);
mongoDatabase
.
withReadPreference
(
ReadPreference
.
secondary
());
System
.
out
.
println
(
"Connect to database successfully"
);
MongoCollection
<
Document
>
collection
=
mongoDatabase
.
getCollection
(
"campaign"
);
MongoCursor
<
Document
>
findIterable
=
collection
.
find
(
Filters
.
and
(
Filters
.
gt
(
"startTime"
,
rightNow
.
getTime
().
getTime
()
/
1000
),
Filters
.
eq
(
"advertiserId"
,
903
))).
iterator
();
Set
<
String
>
set
=
new
HashSet
<>();
while
(
findIterable
.
hasNext
())
{
String
json
=
findIterable
.
next
().
toJson
();
if
(
GsonUtil
.
String2JsonObject
(
json
).
has
(
"packageName"
))
{
String
packageName
=
GsonUtil
.
String2JsonObject
(
json
).
get
(
"packageName"
).
getAsString
();
if
(
StringUtils
.
isNotBlank
(
packageName
))
{
set
.
add
(
packageName
);
}
}
}
System
.
out
.
println
(
"packageNames.size ===>>> "
+
set
.
size
());
MySqlUtil
mySqlUtil
=
new
MySqlUtil
();
mySqlUtil
.
insert
(
set
);
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
e
.
getClass
().
getName
()
+
": "
+
e
.
getMessage
());
}
}
}
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