Merge branch 'group_by_feature' of github.com:thulab/iotdb into group_by_feature

This commit is contained in:
CGF 2017-11-08 09:55:45 +08:00
commit ce2333e6bc
6 changed files with 51 additions and 50 deletions

View File

@ -1,11 +1,5 @@
package cn.edu.tsinghua.iotdb.qp.executor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import cn.edu.tsinghua.iotdb.auth.AuthException;
import cn.edu.tsinghua.iotdb.auth.dao.Authorizer;
import cn.edu.tsinghua.iotdb.engine.filenode.FileNodeManager;
@ -28,18 +22,23 @@ import cn.edu.tsinghua.iotdb.qp.physical.sys.MetadataPlan;
import cn.edu.tsinghua.iotdb.qp.physical.sys.PropertyPlan;
import cn.edu.tsinghua.iotdb.query.engine.FilterStructure;
import cn.edu.tsinghua.iotdb.query.engine.OverflowQueryEngine;
import cn.edu.tsinghua.iotdb.query.engine.groupby.GroupByQueryDataSet;
import cn.edu.tsinghua.iotdb.utils.LoadDataUtils;
import cn.edu.tsinghua.tsfile.common.exception.ProcessorException;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
import cn.edu.tsinghua.tsfile.file.metadata.enums.TSDataType;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.FilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.query.DynamicOneColumnData;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryDataSet;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import cn.edu.tsinghua.tsfile.timeseries.write.record.DataPoint;
import cn.edu.tsinghua.tsfile.timeseries.write.record.TSRecord;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class OverflowQPExecutor extends QueryProcessExecutor {
private OverflowQueryEngine queryEngine;
@ -114,7 +113,7 @@ public class OverflowQPExecutor extends QueryProcessExecutor {
@Override
public QueryDataSet groupBy(List<Pair<Path, String>> aggres, List<FilterStructure> filterStructures,
long unit, long origin, FilterExpression intervals, int fetchSize)
long unit, long origin, SingleSeriesFilterExpression intervals, int fetchSize)
throws ProcessorException, IOException, PathErrorException {
return queryEngine.groupBy(aggres, filterStructures, unit, origin, intervals, fetchSize);
}

View File

@ -1,12 +1,5 @@
package cn.edu.tsinghua.iotdb.qp.executor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import cn.edu.tsinghua.iotdb.exception.PathErrorException;
import cn.edu.tsinghua.iotdb.metadata.MManager;
import cn.edu.tsinghua.iotdb.qp.exception.QueryProcessorException;
@ -20,9 +13,17 @@ import cn.edu.tsinghua.tsfile.common.exception.ProcessorException;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
import cn.edu.tsinghua.tsfile.file.metadata.enums.TSDataType;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.FilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryDataSet;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public abstract class QueryProcessExecutor {
protected ThreadLocal<Integer> fetchSize = new ThreadLocal<>();
@ -90,7 +91,7 @@ public abstract class QueryProcessExecutor {
throws ProcessorException, IOException, PathErrorException;
public abstract QueryDataSet groupBy(List<Pair<Path, String>> aggres, List<FilterStructure> filterStructures,
long unit, long origin, FilterExpression intervals, int fetchSize)
long unit, long origin, SingleSeriesFilterExpression intervals, int fetchSize)
throws ProcessorException, IOException, PathErrorException;
public abstract QueryDataSet query(int formNumber, List<Path> paths, FilterExpression timeFilter, FilterExpression freqFilter,

View File

@ -1,22 +1,23 @@
package cn.edu.tsinghua.iotdb.qp.executor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import cn.edu.tsinghua.iotdb.exception.PathErrorException;
import cn.edu.tsinghua.iotdb.qp.constant.SQLConstant;
import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.iotdb.query.engine.FilterStructure;
import cn.edu.tsinghua.tsfile.common.exception.ProcessorException;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
import cn.edu.tsinghua.tsfile.common.utils.ITsRandomAccessFileReader;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
import cn.edu.tsinghua.tsfile.file.metadata.enums.TSDataType;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.FilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryDataSet;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryEngine;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class SingleFileQPExecutor extends QueryProcessExecutor {
private QueryEngine queryEngine;
@ -56,7 +57,7 @@ public class SingleFileQPExecutor extends QueryProcessExecutor {
@Override
public QueryDataSet groupBy(List<Pair<Path, String>> aggres, List<FilterStructure> filterStructures,
long unit, long origin, FilterExpression intervals, int fetchSize)
long unit, long origin, SingleSeriesFilterExpression intervals, int fetchSize)
throws ProcessorException, IOException, PathErrorException {
throw new ProcessorException("Do not support");
}

View File

@ -1,13 +1,13 @@
package cn.edu.tsinghua.iotdb.qp.executor.iterator;
import cn.edu.tsinghua.iotdb.qp.executor.QueryProcessExecutor;
import cn.edu.tsinghua.iotdb.qp.logical.crud.FilterOperator;
import cn.edu.tsinghua.iotdb.qp.physical.crud.MultiQueryPlan;
import cn.edu.tsinghua.iotdb.query.engine.FilterStructure;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.FilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryDataSet;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import java.util.ArrayList;
import java.util.Arrays;
@ -27,7 +27,7 @@ public class QueryDataSetIterator implements Iterator<QueryDataSet> {
private List<FilterStructure> filterStructures = new ArrayList<>();
private long unit;
private long origin;
private FilterExpression intervals;
private SingleSeriesFilterExpression intervals;
private MultiQueryPlan.QueryType type = MultiQueryPlan.QueryType.QUERY;
//single query
@ -56,7 +56,7 @@ public class QueryDataSetIterator implements Iterator<QueryDataSet> {
//groupby
public QueryDataSetIterator(List<Path> paths, int fetchSize, List<String> aggregations,
List<FilterStructure> filterStructures, long unit, long origin,
FilterExpression intervals, QueryProcessExecutor executor) {
SingleSeriesFilterExpression intervals, QueryProcessExecutor executor) {
this.fetchSize = fetchSize;
this.executor = executor;
this.filterStructures = filterStructures;

View File

@ -1,17 +1,17 @@
package cn.edu.tsinghua.iotdb.qp.physical.crud;
import java.util.ArrayList;
import java.util.List;
import cn.edu.tsinghua.iotdb.qp.logical.crud.FilterOperator;
import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.iotdb.qp.logical.Operator;
import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.FilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExpression;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import cn.edu.tsinghua.tsfile.timeseries.utils.StringContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* {@code MultiQueryPlan} is used in multi-pass SingleQueryPlan. Multi-pass means it's a disjunction
* among a list of SeriesSelectPlans. {@code MultiQueryPlan} return a {@code Iterator<QueryDataSet>}
@ -28,7 +28,7 @@ public class MultiQueryPlan extends PhysicalPlan {
private List<String> aggregations = new ArrayList<>();
private long unit;
private long origin;
private FilterExpression intervals;
private SingleSeriesFilterExpression intervals;
public QueryType getType() {
return type;
@ -60,12 +60,12 @@ public class MultiQueryPlan extends PhysicalPlan {
this.origin = origin;
}
public FilterExpression getIntervals() {
public SingleSeriesFilterExpression getIntervals() {
return intervals;
}
public void setIntervals(FilterExpression intervals) {
this.intervals = intervals;
this.intervals = (SingleSeriesFilterExpression)intervals;
}
public MultiQueryPlan(ArrayList<SingleQueryPlan> selectPlans, List<String> aggregations) {

View File

@ -1,25 +1,13 @@
package cn.edu.tsinghua.iotdb.qp.utils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.TreeSet;
import cn.edu.tsinghua.iotdb.exception.PathErrorException;
import cn.edu.tsinghua.iotdb.qp.constant.SQLConstant;
import cn.edu.tsinghua.iotdb.query.engine.FilterStructure;
import cn.edu.tsinghua.iotdb.qp.executor.QueryProcessExecutor;
import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.iotdb.qp.physical.crud.DeletePlan;
import cn.edu.tsinghua.iotdb.qp.physical.crud.InsertPlan;
import cn.edu.tsinghua.iotdb.qp.physical.crud.UpdatePlan;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.iotdb.query.engine.FilterStructure;
import cn.edu.tsinghua.tsfile.common.constant.SystemConstant;
import cn.edu.tsinghua.tsfile.common.exception.ProcessorException;
import cn.edu.tsinghua.tsfile.common.utils.Pair;
@ -30,8 +18,20 @@ import cn.edu.tsinghua.tsfile.timeseries.filter.definition.SingleSeriesFilterExp
import cn.edu.tsinghua.tsfile.timeseries.filter.visitorImpl.SingleValueVisitor;
import cn.edu.tsinghua.tsfile.timeseries.read.query.QueryDataSet;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Field;
import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
import cn.edu.tsinghua.tsfile.timeseries.read.support.RowRecord;
import cn.edu.tsinghua.tsfile.timeseries.utils.StringContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.TreeSet;
/**
* Implement a simple executor with a memory demo reading processor for test.
@ -180,7 +180,7 @@ public class MemIntQpExecutor extends QueryProcessExecutor {
@Override
public QueryDataSet groupBy(List<Pair<Path, String>> aggres, List<FilterStructure> filterStructures,
long unit, long origin, FilterExpression intervals, int fetchSize)
long unit, long origin, SingleSeriesFilterExpression intervals, int fetchSize)
throws ProcessorException, IOException, PathErrorException {
throw new ProcessorException("Do not support");
}