Package org.olap4cloud.client

Examples of org.olap4cloud.client.CubeQueryResult


 
 
 
  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();
    }
View Full Code Here


    cubeQuery.getAggregates().add(new CubeQueryAggregate("min(m1)"));
    cubeQuery.getAggregates().add(new CubeQueryAggregate("max(m2)"));
    cubeQuery.getAggregates().add(new CubeQueryAggregate("count(m3)"));
    cubeQuery.getGroupBy().add("d1");
    OLAPEngine olapEngine = new OLAPEngine();
    CubeQueryResult r = olapEngine.executeQuery(cubeQuery, cubeDescriptor);
    for(CubeQueryResultRow row: r.getRows()) {
      for(long l: row.getGroupBy())
        System.out.print(l + "\t");
      for(double d: row.getValues())
        System.out.print(d + "\t");
      System.out.println();
View Full Code Here

TOP

Related Classes of org.olap4cloud.client.CubeQueryResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.