|
@@ -20,7 +20,8 @@ public class FeatureDiff {
|
|
|
|
|
|
private static ODPSService odpsService = new ODPSService();
|
|
|
|
|
|
- private static Map<String, String> tableToCol;
|
|
|
+ private static Map<String, String> tableToCol = new HashMap<>();
|
|
|
+ ;
|
|
|
private static Set<String> abCodes;
|
|
|
|
|
|
static {
|
|
@@ -29,28 +30,9 @@ public class FeatureDiff {
|
|
|
abCodes.add("ab1");
|
|
|
abCodes.add("ab2");
|
|
|
abCodes.add("ab3");
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- tableToCol = new HashMap<>();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ private static void addUserTable() {
|
|
|
tableToCol.put("alg_mid_feature_play", "c1_feature");
|
|
|
tableToCol.put("alg_mid_feature_share_and_return", "c2_feature");
|
|
|
tableToCol.put("alg_mid_feature_play_tags", "c3_feature");
|
|
@@ -60,11 +42,43 @@ public class FeatureDiff {
|
|
|
tableToCol.put("alg_mid_feature_feed_exp_return_tags", "c7_feature");
|
|
|
tableToCol.put("alg_mid_feature_sharecf", "c8_feature");
|
|
|
tableToCol.put("alg_mid_feature_returncf", "c9_feature");
|
|
|
+ }
|
|
|
|
|
|
+ private static void addVideoTable() {
|
|
|
+ tableToCol.put("alg_vid_feature_all_exp", "b1_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_all_share", "b2_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_all_return", "b3_feature");
|
|
|
+
|
|
|
+
|
|
|
+ tableToCol.put("alg_vid_feature_exp2share", "b6_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_share2return", "b7_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_noflow_exp", "b8_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_noflow_root_share", "b9_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_noflow_root_return", "b10_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_flow_exp", "b11_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_flow_root_share", "b12_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_flow_root_return", "b13_feature");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ tableToCol.put("alg_vid_feature_feed_province_exp", "b17_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_province_root_share", "b18_feature");
|
|
|
+ tableToCol.put("alg_vid_feature_feed_province_root_return", "b19_feature");
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
+ if (args[0].equals("0")) {
|
|
|
+ addVideoTable();
|
|
|
+ }
|
|
|
+ if (args[0].equals("1")) {
|
|
|
+ addUserTable();
|
|
|
+ }
|
|
|
+ if (args[0].equals("2")) {
|
|
|
+ addVideoTable();
|
|
|
+ addUserTable();
|
|
|
+ }
|
|
|
+
|
|
|
SparkConf sparkConf = new SparkConf()
|
|
|
|
|
|
.setAppName("odps sync to redis");
|
|
@@ -76,7 +90,7 @@ public class FeatureDiff {
|
|
|
String table = "alg_recsys_sample_all_new";
|
|
|
String partition = "dt=" + args[1] + ",hh=" + args[2];
|
|
|
|
|
|
- int partitionNum = Integer.valueOf(args[0]);
|
|
|
+ int partitionNum = Integer.valueOf(args[3]);
|
|
|
JavaRDD<Map<String, String>> fieldValues = odpsService.read(jsc, project, table, partition, partitionNum);
|
|
|
if (fieldValues == null) {
|
|
|
log.info("odps empty");
|