From 94ec2aa6509e258cac322fe5b5f86ae1aeab0293 Mon Sep 17 00:00:00 2001 From: "aoei.me" Date: Tue, 5 Jun 2018 10:51:16 +0800 Subject: [PATCH] Add log info in dynamic one column data. (#156) --- .../read/query/DynamicOneColumnData.java | 12 ++--- ...QueryExecutorWithGlobalTimeFilterImpl.java | 48 ------------------- .../impl/QueryExecutorWithoutFilterImpl.java | 45 ----------------- .../timeseries/write/record/TSRecord.java | 4 ++ 4 files changed, 10 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithGlobalTimeFilterImpl.java delete mode 100644 src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithoutFilterImpl.java diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/DynamicOneColumnData.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/DynamicOneColumnData.java index a06e090f..0a1b711f 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/DynamicOneColumnData.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/DynamicOneColumnData.java @@ -339,10 +339,10 @@ public void putBinary(Binary v) { */ private void rangeCheck(int idx) { if (idx < 0) { - throw new IndexOutOfBoundsException("Index is negative: " + idx); + throw new IndexOutOfBoundsException("DynamicOneColumnData value range check, Index is negative: " + idx); } if (idx >= valueLength) { - throw new IndexOutOfBoundsException("Index : " + idx + ". Length : " + valueLength); + throw new IndexOutOfBoundsException("DynamicOneColumnData value range check, Index : " + idx + ". Length : " + valueLength); } } @@ -352,19 +352,19 @@ private void rangeCheck(int idx) { */ private void rangeCheckForTime(int idx) { if (idx < 0) { - throw new IndexOutOfBoundsException("Index is negative: " + idx); + throw new IndexOutOfBoundsException("DynamicOneColumnData time range check, Index is negative: " + idx); } if (idx >= timeLength) { - throw new IndexOutOfBoundsException("Index : " + idx + ". Length : " + valueLength); + throw new IndexOutOfBoundsException("DynamicOneColumnData time range check, Index : " + idx + ". Length : " + timeLength); } } private void rangeCheckForEmptyTime(int idx) { if (idx < 0) { - throw new IndexOutOfBoundsException("Index is negative: " + idx); + throw new IndexOutOfBoundsException("DynamicOneColumnData empty time range check, Index is negative: " + idx); } if (idx >= emptyTimeLength) { - throw new IndexOutOfBoundsException("Index : " + idx + ". Length : " + valueLength); + throw new IndexOutOfBoundsException("DynamicOneColumnData empty time range check, Index : " + idx + ". Length : " + emptyTimeLength); } } diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithGlobalTimeFilterImpl.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithGlobalTimeFilterImpl.java deleted file mode 100644 index 640e1591..00000000 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithGlobalTimeFilterImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.edu.tsinghua.tsfile.timeseries.readV2.query.impl; - -import cn.edu.tsinghua.tsfile.timeseries.filterV2.basic.Filter; -import cn.edu.tsinghua.tsfile.timeseries.filterV2.expression.impl.GlobalTimeFilter; -import cn.edu.tsinghua.tsfile.timeseries.read.support.Path; -import cn.edu.tsinghua.tsfile.timeseries.readV2.common.EncodedSeriesChunkDescriptor; -import cn.edu.tsinghua.tsfile.timeseries.readV2.controller.MetadataQuerier; -import cn.edu.tsinghua.tsfile.timeseries.readV2.controller.SeriesChunkLoader; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryDataSet; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryExecutor; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryExpression; -import cn.edu.tsinghua.tsfile.timeseries.readV2.reader.SeriesReader; -import cn.edu.tsinghua.tsfile.timeseries.readV2.reader.impl.SeriesReaderFromSingleFileWithFilterImpl; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; - -/** - * Created by zhangjinrui on 2017/12/27. - */ -public class QueryExecutorWithGlobalTimeFilterImpl implements QueryExecutor { - - private SeriesChunkLoader seriesChunkLoader; - private MetadataQuerier metadataQuerier; - - public QueryExecutorWithGlobalTimeFilterImpl(SeriesChunkLoader seriesChunkLoader, MetadataQuerier metadataQuerier) { - this.seriesChunkLoader = seriesChunkLoader; - this.metadataQuerier = metadataQuerier; - } - - @Override - public QueryDataSet execute(QueryExpression queryExpression) throws IOException { - LinkedHashMap readersOfSelectedSeries = new LinkedHashMap<>(); - Filter timeFilter = ((GlobalTimeFilter) queryExpression.getQueryFilter()).getFilter(); - initReadersOfSelectedSeries(readersOfSelectedSeries, queryExpression.getSelectedSeries(), timeFilter); - return new MergeQueryDataSet(readersOfSelectedSeries); - } - - private void initReadersOfSelectedSeries(LinkedHashMap readersOfSelectedSeries, - List selectedSeries, Filter timeFilter) throws IOException { - for (Path path : selectedSeries) { - List encodedSeriesChunkDescriptorList = metadataQuerier.getSeriesChunkDescriptorList(path); - SeriesReader seriesReader = new SeriesReaderFromSingleFileWithFilterImpl(seriesChunkLoader, encodedSeriesChunkDescriptorList, timeFilter); - readersOfSelectedSeries.put(path, seriesReader); - } - } -} diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithoutFilterImpl.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithoutFilterImpl.java deleted file mode 100644 index 11642378..00000000 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/readV2/query/impl/QueryExecutorWithoutFilterImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.edu.tsinghua.tsfile.timeseries.readV2.query.impl; - -import cn.edu.tsinghua.tsfile.timeseries.read.support.Path; -import cn.edu.tsinghua.tsfile.timeseries.readV2.common.EncodedSeriesChunkDescriptor; -import cn.edu.tsinghua.tsfile.timeseries.readV2.controller.MetadataQuerier; -import cn.edu.tsinghua.tsfile.timeseries.readV2.controller.SeriesChunkLoader; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryDataSet; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryExecutor; -import cn.edu.tsinghua.tsfile.timeseries.readV2.query.QueryExpression; -import cn.edu.tsinghua.tsfile.timeseries.readV2.reader.SeriesReader; -import cn.edu.tsinghua.tsfile.timeseries.readV2.reader.impl.SeriesReaderFromSingleFileWithoutFilterImpl; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; - -/** - * Created by zhangjinrui on 2017/12/27. - */ -public class QueryExecutorWithoutFilterImpl implements QueryExecutor { - - private SeriesChunkLoader seriesChunkLoader; - private MetadataQuerier metadataQuerier; - - public QueryExecutorWithoutFilterImpl(SeriesChunkLoader seriesChunkLoader, MetadataQuerier metadataQuerier) { - this.seriesChunkLoader = seriesChunkLoader; - this.metadataQuerier = metadataQuerier; - } - - @Override - public QueryDataSet execute(QueryExpression queryExpression) throws IOException { - LinkedHashMap readersOfSelectedSeries = new LinkedHashMap<>(); - initReadersOfSelectedSeries(readersOfSelectedSeries, queryExpression.getSelectedSeries()); - return new MergeQueryDataSet(readersOfSelectedSeries); - } - - private void initReadersOfSelectedSeries(LinkedHashMap readersOfSelectedSeries, - List selectedSeries) throws IOException { - for (Path path : selectedSeries) { - List encodedSeriesChunkDescriptorList = metadataQuerier.getSeriesChunkDescriptorList(path); - SeriesReader seriesReader = new SeriesReaderFromSingleFileWithoutFilterImpl(seriesChunkLoader, encodedSeriesChunkDescriptorList); - readersOfSelectedSeries.put(path, seriesReader); - } - } -} diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/TSRecord.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/TSRecord.java index 7b0c0dab..18dd01c8 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/TSRecord.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/TSRecord.java @@ -21,6 +21,10 @@ public TSRecord(long timestamp, String deltaObjectId) { this.deltaObjectId = deltaObjectId; } + public void setTime(long timestamp) { + this.time = timestamp; + } + public void addTuple(DataPoint tuple) { this.dataPointList.add(tuple); }