Package org.lealone.hbase.result

Examples of org.lealone.hbase.result.HBaseSerializedResult


        }
        //originalSelect.isGroupQuery()如果是false,那么按org.apache.hadoop.hbase.client.ClientScanner的功能来实现。
        //只要Select语句中出现聚合函数、groupBy、Having三者之一都被认为是GroupQuery,
        //对于GroupQuery需要把Select语句同时发给相关的RegionServer,得到结果后再合并。
        if (!select.isGroupQuery() && select.getSortOrder() == null)
            return new HBaseSerializedResult(commands, maxRows, scrollable, select);

        int size = commands.size();
        List<Future<ResultInterface>> futures = New.arrayList(size);
        List<ResultInterface> results = New.arrayList(size);
        for (int i = 0; i < size; i++) {
View Full Code Here


import org.lealone.result.ResultInterface;

public class HBaseMergedResult extends DelegatedResult {
    public HBaseMergedResult(List<ResultInterface> results, Select newSelect, Select oldSelect) {
        //1. 结果集串行化,为合并做准备
        HBaseSerializedResult serializedResult = new HBaseSerializedResult(results, oldSelect);
        Table table = newSelect.getTopTableFilter().getTable();
        newSelect.getTopTableFilter().setIndex(
                new HBaseMergedIndex(serializedResult, table, -1, IndexColumn.wrap(table.getColumns()), IndexType
                        .createScan(false)));

        //2. 把多个结果集合并
        ResultInterface mergedResult = newSelect.queryGroupMerge();

        //3. 计算合并后的结果集,
        //例如oldSelect="select avg"时,在分布式环境要转成newSelect="select count, sum",
        //此时就由count, sum来算出avg
        ResultInterface calculatedResult = oldSelect.calculate(mergedResult, newSelect);

        //4. 如果不存在avg、stddev这类需要拆分为count、sum的计算,此时mergedResult和calculatedResult是同一个实例
        //否则就是不同实例,需要再一次按oldSelect合并结果集
        if (mergedResult != calculatedResult) {
            table = oldSelect.getTopTableFilter().getTable();
            oldSelect.getTopTableFilter().setIndex(
                    new HBaseMergedIndex(calculatedResult, table, -1, IndexColumn.wrap(table.getColumns()), IndexType
                            .createScan(false)));
            //5. 最终结果集
            result = oldSelect.queryGroupMerge();

            //6. 立刻关闭中间结果集
            serializedResult.close();
            mergedResult.close();
            calculatedResult.close();
        } else {
            result = mergedResult;
        }
View Full Code Here

TOP

Related Classes of org.lealone.hbase.result.HBaseSerializedResult

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.