private static CubeQueryResult getCubeQueryResult(String outPath,
CubeScan scan) throws Exception {
CubeQueryResult cubeQueryResult = new CubeQueryResult();
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
Path[] fileList = FileUtil.stat2Paths(fs.listStatus(new Path(outPath), new OutputLogFilter()));
for(Path path: fileList) {
FSDataInputStream fsin = fs.open(path);
BufferedReader reader = new BufferedReader(new InputStreamReader(fsin));
String s = null;
do {
s = reader.readLine();
if(s != null) {
StringTokenizer sb = new StringTokenizer(s, "\t", false);
CubeQueryResultRow row = new CubeQueryResultRow();
for(int i = 0; i < scan.getGroupBy().length; i ++)
row.getGroupBy().add(Long.parseLong(sb.nextToken()));
for(int i = 0; i < scan.getCubeScanAggregates().size(); i ++)
row.getValues().add(Double.parseDouble(sb.nextToken()));
cubeQueryResult.getRows().add(row);
}
} while(s != null);
reader.close();
fsin.close();
}