Package com.inadco.hbl.api

Examples of com.inadco.hbl.api.Cuboid


            dimName2GroupKeyOffsetMap = new HashMap<String, Integer>(11);
        if (measureName2indexMap == null)
            measureName2indexMap = new HashMap<String, Integer>(11);
       
        Validate.notNull(cube, "A cube not set");
        Cuboid cuboid = findCuboid();

        Validate.notNull(cuboid, "Unable to find a suitable cuboid for the slice query.");

        /*
         * FIXME, TODO: check slices for overlapping. otherwise, if slices
         * overlap, not only we'd be performing more scans than needed, but they
         * will also contain duplicate counts.
         *
         * for now we just have to assume that slices will not overlap.
         */
        List<ScanSpec> scanSpecs = new ArrayList<ScanSpec>();

        List<Range> partialSpec = new ArrayList<Range>();

        int groupKeyLen = 0, curKeyLen = 0;

        for (Dimension dim : cuboid.getCuboidDimensions()) {
            String dimName = dim.getName();
            dimName2GroupKeyOffsetMap.put(dimName, curKeyLen);
            curKeyLen += dim.getKeyLen();
            if (groupDimensions.contains(dim.getName()))
                groupKeyLen = curKeyLen;
View Full Code Here


        Set<String> dimensionSubset = new HashSet<String>();
        dimensionSubset.addAll(dimSlices.keySet());
        dimensionSubset.addAll(groupDimensions);

        Cuboid cuboid = null;

        // find a suitable cuboid per above with fewest extra dimensions.
        for (Cuboid c : cube.getCuboids()) {

            List<String> cPath = c.getCuboidPath();
            // filter out smaller cubes
            if (cPath.size() < dimensionSubset.size())
                continue;

            // filter out those that don't contain all the dimensions we need
            if (!cPath.containsAll(dimensionSubset))
                continue;

            // now check group dimensions that must be stacked on the left.
            int cnt = groupDimensions.size();
            for (String dimName : cPath) {
                if (groupDimensions.contains(dimName)) {
                    cnt--;
                } else {
                    /*
                     * easy but still quite effective optimization is that if
                     * slices are degenerate, their dimension could be pushed
                     * left in the cuboid without breaking inline grouping
                     * prerequisites. This is surprisingly much more often the
                     * case as degenerate slicing is quite common.
                     */
                    List<Slice> slices = dimSlices.get(dimName);
                    if (slices == null || slices.size() != 1)
                        break; // clearly not degenerate

                    Slice slice = slices.get(0);
                    if (slice.isLeftOpen() || slice.isRightOpen()
                        || !slice.getLeftBound().equals(slice.getRightBound()))
                        break; // not degenerate.
                }
            }
            if (cnt > 0)
                continue;

            // found qualifying cuboid. good.
            if (cuboid == null || cPath.size() < cuboid.getCuboidPath().size())
                cuboid = c;
        }

        return cuboid;

View Full Code Here

        Validate.notNull(input, "input cannot be null");

        String cuboidPath = (String) input.get(0);
        Validate.notNull(cuboidPath, "path parameter can't be null");

        Cuboid c = path2CuboidMap.get(cuboidPath);
        Validate.notNull(c, "cuboid not found");

        DataBag db = new DefaultDataBag();

        byte[] key = new byte[c.getKeyLen()];
        walkDimensions(input, db, key, c.getCuboidDimensions(), 0, 0, TupleFactory.getInstance());

        return db;
    }
View Full Code Here

        dropTable();
        createTable();
    }

    private void insertTestData() throws IOException {
        Cuboid testCuboid = hblAdmin.getCube().findCuboidForPath(HblUtil.decodeCuboidPath("dim1/dim2"));
        Assert.notNull(testCuboid);

        byte[] key = new byte[testCuboid.getKeyLen()];
        for (long[] data : testData) {
            Dimension dim1 = testCuboid.getCuboidDimensions().get(0);
            Dimension dim2 = testCuboid.getCuboidDimensions().get(1);
        }
    }
View Full Code Here

TOP

Related Classes of com.inadco.hbl.api.Cuboid

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.