Package com.inadco.hbl.client

Examples of com.inadco.hbl.client.PreparedAggregateQuery


            endTime.add(Calendar.HOUR_OF_DAY, 3);
            // recalculate the calendars
            startTime.getTimeInMillis();
            endTime.getTimeInMillis();

            PreparedAggregateQuery query = queryClient.createPreparedQuery();

            /*
             * test reuse of the prepared query. Should speedup stuff exactly as
             * prepared query is supposed to do. we also have an option of
             * re-preparing query at any time, but we still need to run reset()
             * to clean out stuff like parameters initialized and execution.
             * reset() does not necessarily cancel previously existing AST tree
             * of the query, only prepare() updates that. but prepare does
             * reset() implicitly, so if we re-prepared the query, the previous
             * parameter set cannot be used.
             */
            long ms = System.currentTimeMillis();
            query.prepare("select dim1, SUM(impCnt) as ?, COUNT(impCnt) as ?, SUM(click) as clickSum, "
                + "COUNT(click) as clickCnt, cannyAvg7d(clickTimeSeries) as ctr " +

                "from Example1 where dim1 in [?] " + ", impressionTime in [?,?) " + ", dim2 in [ '1' ]"
                + "group by dim1");
            System.out.printf("query prepared in %d ms\n", System.currentTimeMillis() - ms);

            for (int i = 0; i < 5; i++) {

                /**
                 * same as client2 but print the summaries separately (no
                 * grouping).
                 *
                 */
                ms = System.currentTimeMillis();

                // demo: can parameterize aliases
                // or measure names in the select expression.
                query.setHblParameter(0, "impSum");
                query.setHblParameter(1, "impCnt");

                query.setHblParameter(2, ids[1]);
                // query.setHblParameter(3, ids[1]);
                query.setHblParameter(3, startTime);
                query.setHblParameter(4, endTime);

                // query.addMeasure("impCnt").addMeasure("click");
                // query.addClosedSlice("dim1",ids[0],ids[1]).addGroupBy("dim1");
                // query.addHalfOpenSlice("impressionTime", startTime, endTime);

                AggregateResultSet rs = query.execute();
                closeables.addFirst(rs);
                while (rs.hasNext()) {
                    rs.next();
                    PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();

View Full Code Here


        System.out.println("Test6:\n\n");

        Deque<Closeable> closeables = new ArrayDeque<Closeable>();
        try {

            PreparedAggregateQuery query = queryClient.createPreparedQuery();

            /*
             * test reuse of the prepared query. Should speedup stuff exactly as
             * prepared query is supposed to do. we also have an option of
             * re-preparing query at any time, but we still need to run reset()
             * to clean out stuff like parameters initialized and execution.
             * reset() does not necesserily cancel previously existing AST tree
             * of the query, only prepare() updates that. but prepare does
             * reset() implicitly, so if we re-prepared the query, the previous
             * parameter set cannot be used.
             */
            long ms = System.currentTimeMillis();
            query.prepare("select SUM(impCnt) as imp, SUM(click) as click, cannyAvg7d(clickTimeSeries) as wctr7d,"
                + "cannyAvg90d(clickTimeSeries) as wctr90d " + " " + "from Example1 where dim1 in [?]");
            System.out.printf("query prepared in %d ms\n", System.currentTimeMillis() - ms);

            for (int i = 0; i < 3; i++) {

                /*
                 * same as client2 but print the summaries separately (no
                 * grouping).
                 */
                ms = System.currentTimeMillis();

                query.setHblParameter(0, i);

                AggregateResultSet rs = query.execute();
                closeables.addFirst(rs);
                while (rs.hasNext()) {
                    rs.next();
                    PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();
                    System.out.printf("dim1: %032X impCnt %.4f clickCnt %.4f ctr %.4f wctr 7d %.4f, wctr90d %.4f \n",
View Full Code Here

            // recalculate the calendars
            startTime.getTimeInMillis();
            endTime.getTimeInMillis();

            PreparedAggregateQuery query = queryClient.createPreparedQuery();

            /*
             * test reuse of the prepared query. Should speedup stuff exactly as
             * prepared query is supposed to do. we also have an option of
             * re-preparing query at any time, but we still need to run reset()
             * to clean out stuff like parameters initialized and execution.
             * reset() does not necessarily cancel previously existing AST tree
             * of the query, only prepare() updates that. but prepare does
             * reset() implicitly, so if we re-prepared the query, the previous
             * parameter set cannot be used.
             */
            long ms = System.currentTimeMillis();
            query.prepare("select dim1, SUM(impCnt) as ?, COUNT(impCnt) as ?, SUM(click) as clickSum, "
                + "COUNT(click) as clickCnt, cannyAvg7d(clickTimeSeries) as ctr " +

                "from Example1 where impressionTime in [?,?), dim1 in [?] " + "group by dim1");
            System.out.printf("query prepared in %d ms\n", System.currentTimeMillis() - ms);

            // warm up helps?
            for (int k = 0; k < 200; k++) {

                for (int i = 0; i < 2; i++) {

                    /**
                     * same as client2 but print the summaries separately (no
                     * grouping).
                     *
                     */
                    ms = System.currentTimeMillis();

                    // demo: can parameterize aliases
                    // or measure names in the select expression.
                    query.setHblParameter(0, "impSum");
                    query.setHblParameter(1, "impCnt");

                    query.setHblParameter(2, startTime);
                    query.setHblParameter(3, endTime);

                    query.setHblParameter(4, i);

                    AggregateResultSet rs = query.execute();
                    closeables.addFirst(rs);
                    while (rs.hasNext()) {
                        rs.next();
                        PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();

View Full Code Here

            // recalculate the calendars
            startTime.getTimeInMillis();
            endTime.getTimeInMillis();

            PreparedAggregateQuery query = queryClient.createPreparedQuery();

            /*
             * test reuse of the prepared query. Should speedup stuff exactly as
             * prepared query is supposed to do. we also have an option of
             * re-preparing query at any time, but we still need to run reset()
             * to clean out stuff like parameters initialized and execution.
             * reset() does not necessarily cancel previously existing AST tree
             * of the query, only prepare() updates that. but prepare does
             * reset() implicitly, so if we re-prepared the query, the previous
             * parameter set cannot be used.
             */
            long ms = System.currentTimeMillis();
            query.prepare("select dim1, charDim1, SUM(impCnt) as ?, COUNT(impCnt) as ?, SUM(click) as clickSum, "
                + "COUNT(click) as clickCnt, cannyAvg7d(clickTimeSeries) as ctr " +

                "from Example1 where impressionTime in [?,?), dim1 in [?] " + "group by dim1, charDim1");
            System.out.printf("query prepared in %d ms\n", System.currentTimeMillis() - ms);

            for (int i = 0; i < 2; i++) {

                /**
                 * same as client2 but print the summaries separately (no
                 * grouping).
                 *
                 */
                ms = System.currentTimeMillis();

                // demo: can parameterize aliases
                // or measure names in the select expression.
                query.setHblParameter(0, "impSum");
                query.setHblParameter(1, "impCnt");

                query.setHblParameter(2, startTime);
                query.setHblParameter(3, endTime);

                query.setHblParameter(4, i);

                AggregateResultSet rs = query.execute();
                closeables.addFirst(rs);
                while (rs.hasNext()) {
                    rs.next();
                    PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();

View Full Code Here

        System.out.println("Test9:\n\n");

        Deque<Closeable> closeables = new ArrayDeque<Closeable>();
        try {

            PreparedAggregateQuery query = queryClient.createPreparedQuery();

            /*
             * test reuse of the prepared query. Should speedup stuff exactly as
             * prepared query is supposed to do. we also have an option of
             * re-preparing query at any time, but we still need to run reset()
             * to clean out stuff like parameters initialized and execution.
             * reset() does not necessarily cancel previously existing AST tree
             * of the query, only prepare() updates that. but prepare does
             * reset() implicitly, so if we re-prepared the query, the previous
             * parameter set cannot be used.
             */
            long ms = System.currentTimeMillis();
            query.prepare("select dim1, dim2, charDim1, SUM(impCnt) as impCnt "
                + "from Example1 group by dim1, charDim1,dim2");
            System.out.printf("query prepared in %d ms\n", System.currentTimeMillis() - ms);

            ms = System.currentTimeMillis();

            // demo: can parameterize aliases
            // or measure names in the select expression.

            AggregateResultSet rs = query.execute();
            closeables.addFirst(rs);
            while (rs.hasNext()) {
                rs.next();
                PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();

View Full Code Here

TOP

Related Classes of com.inadco.hbl.client.PreparedAggregateQuery

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.