Connection con = DriverManager.getConnection(
"jdbc:mdrill://adhoc7.kgb.cm6:9999", "", "");
Statement stmt = con.createStatement();
MdrillQueryResultSet res = null;
res = (MdrillQueryResultSet) stmt.executeQuery(sql);
while (res.next()) {
String thedate = res.getString("thedate");
String pid = res.getString("pid");
int index = dayIndex.get(thedate);
PidStat stat = rtn.get(pid);
if (stat == null) {
stat = new PidStat();
stat.start = start;
stat.end = end;
stat.dayList = dayList;
stat.p4pclick = new double[dayList.length];
stat.p4ppv = new double[dayList.length];
rtn.put(pid, stat);
}
stat.p4ppv[index] = Double
.parseDouble(res.getString("records"));
}
con.close();
}
{
String sql = "select " + " thedate,pid,sum(records) as records "
+ " from tanx_click where thedate in ('" + dayList[0]
+ "','" + dayList[1] + "','" + dayList[2] + "','"
+ dayList[3] + "','" + dayList[4] + "') " + " and pid in ("
+ pidliststr + ") and " + minfilter
+ " group by thedate,pid limit 0,8000 ";
Connection con = DriverManager.getConnection(
"jdbc:mdrill://adhoc7.kgb.cm6:9999", "", "");
Statement stmt = con.createStatement();
MdrillQueryResultSet res = null;
res = (MdrillQueryResultSet) stmt.executeQuery(sql);
while (res.next()) {
String thedate = res.getString("thedate");
String pid = res.getString("pid");
int index = dayIndex.get(thedate);
PidStat stat = rtn.get(pid);
if (stat == null) {
stat = new PidStat();
stat.start = start;
stat.end = end;
stat.dayList = dayList;
stat.p4pclick = new double[dayList.length];
stat.p4ppv = new double[dayList.length];
rtn.put(pid, stat);
}
stat.p4pclick[index] = Double.parseDouble(res
.getString("records"));
}
con.close();
}