Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iznauy committed Jul 27, 2021
1 parent 5edd57d commit 859175f
Showing 1 changed file with 83 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ public List<? extends IginxPlan> generateSubPlans(RequestContext requestContext)
public List<DeleteColumnsPlan> splitDeleteColumnsPlan(DeleteColumnsPlan plan, List<SplitInfo> infoList) {
List<DeleteColumnsPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
DeleteColumnsPlan subPlan = new DeleteColumnsPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getStorageUnit()
);
plans.add(subPlan);
Expand All @@ -302,8 +306,12 @@ public List<InsertColumnRecordsPlan> splitInsertColumnRecordsPlan(InsertColumnRe
if (valuesAndBitmaps.k.length == 0) {
continue;
}
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
InsertColumnRecordsPlan subPlan = new InsertColumnRecordsPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
timestampsAndIndexes.k,
valuesAndBitmaps.k,
valuesAndBitmaps.v,
Expand All @@ -325,8 +333,12 @@ public List<InsertRowRecordsPlan> splitInsertRowRecordsPlan(InsertRowRecordsPlan
if (valuesAndBitmaps.k.length == 0) {
continue;
}
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
InsertRowRecordsPlan subPlan = new InsertRowRecordsPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
timestampsAndIndexes.k,
valuesAndBitmaps.k,
valuesAndBitmaps.v,
Expand All @@ -343,8 +355,12 @@ public List<InsertRowRecordsPlan> splitInsertRowRecordsPlan(InsertRowRecordsPlan
public List<DeleteDataInColumnsPlan> splitDeleteDataInColumnsPlan(DeleteDataInColumnsPlan plan, List<SplitInfo> infoList) {
List<DeleteDataInColumnsPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
DeleteDataInColumnsPlan subPlan = new DeleteDataInColumnsPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -357,8 +373,12 @@ public List<DeleteDataInColumnsPlan> splitDeleteDataInColumnsPlan(DeleteDataInCo
public List<QueryDataPlan> splitQueryDataPlan(QueryDataPlan plan, List<SplitInfo> infoList) {
List<QueryDataPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
QueryDataPlan subPlan = new QueryDataPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -371,8 +391,12 @@ public List<QueryDataPlan> splitQueryDataPlan(QueryDataPlan plan, List<SplitInfo
public List<ValueFilterQueryPlan> splitValueFilterQueryPlan(ValueFilterQueryPlan plan, List<SplitInfo> infoList) {
List<ValueFilterQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
ValueFilterQueryPlan subPlan = new ValueFilterQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
plan.getBooleanExpression(),
Expand All @@ -386,8 +410,12 @@ public List<ValueFilterQueryPlan> splitValueFilterQueryPlan(ValueFilterQueryPlan
public List<MaxQueryPlan> splitMaxQueryPlan(MaxQueryPlan plan, List<SplitInfo> infoList) {
List<MaxQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
MaxQueryPlan subPlan = new MaxQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -400,67 +428,71 @@ public List<MaxQueryPlan> splitMaxQueryPlan(MaxQueryPlan plan, List<SplitInfo> i
private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<SplitInfo> infoList) {
List<IginxPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
IginxPlan subPlan = null;
switch (info.getType()) {
case MAX:
subPlan = new MaxQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case MIN:
subPlan = new MinQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case FIRST:
subPlan = new FirstQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case LAST:
subPlan = new LastQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case AVG:
subPlan = new AvgQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case SUM:
subPlan = new SumQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case COUNT:
subPlan = new CountQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
info.getStorageUnit()
);
break;
case DOWNSAMPLE_MAX:
subPlan = new DownsampleMaxQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -469,7 +501,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_MIN:
subPlan = new DownsampleMinQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -478,7 +510,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_FIRST:
subPlan = new DownsampleFirstQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -487,7 +519,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_LAST:
subPlan = new DownsampleLastQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -496,7 +528,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_AVG:
subPlan = new DownsampleAvgQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -505,7 +537,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_SUM:
subPlan = new DownsampleSumQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -514,7 +546,7 @@ private List<IginxPlan> splitDownsampleQueryPlan(DownsampleQueryPlan plan, List<
break;
case DOWNSAMPLE_COUNT:
subPlan = new DownsampleCountQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
info.getTimeInterval().getStartTime(),
info.getTimeInterval().getEndTime(),
plan.getPrecision(),
Expand All @@ -537,8 +569,12 @@ public List<IginxPlan> splitDownsampleMaxQueryPlan(DownsampleMaxQueryPlan plan,
public List<MinQueryPlan> splitMinQueryPlan(MinQueryPlan plan, List<SplitInfo> infoList) {
List<MinQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
MinQueryPlan subPlan = new MinQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -555,8 +591,12 @@ public List<IginxPlan> splitDownsampleMinQueryPlan(DownsampleMinQueryPlan plan,
public List<FirstQueryPlan> splitFirstQueryPlan(FirstQueryPlan plan, List<SplitInfo> infoList) {
List<FirstQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
FirstQueryPlan subPlan = new FirstQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -573,8 +613,12 @@ public List<IginxPlan> splitDownsampleFirstQueryPlan(DownsampleFirstQueryPlan pl
public List<LastQueryPlan> splitLastQueryPlan(LastQueryPlan plan, List<SplitInfo> infoList) {
List<LastQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
LastQueryPlan subPlan = new LastQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -591,8 +635,12 @@ public List<IginxPlan> splitDownsampleLastQueryPlan(DownsampleLastQueryPlan plan
public List<CountQueryPlan> splitCountQueryPlan(CountQueryPlan plan, List<SplitInfo> infoList) {
List<CountQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
CountQueryPlan subPlan = new CountQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -609,8 +657,12 @@ public List<IginxPlan> splitDownsampleCountQueryPlan(DownsampleCountQueryPlan pl
public List<SumQueryPlan> splitSumQueryPlan(SumQueryPlan plan, List<SplitInfo> infoList) {
List<SumQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
SumQueryPlan subPlan = new SumQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand All @@ -627,8 +679,12 @@ public List<IginxPlan> splitDownsampleSumQueryPlan(DownsampleSumQueryPlan plan,
public List<AvgQueryPlan> splitAvgQueryPlan(AvgQueryPlan plan, List<SplitInfo> infoList) {
List<AvgQueryPlan> plans = new ArrayList<>();
for (SplitInfo info : infoList) {
List<String> paths = plan.getPathsByInterval(info.getTimeSeriesInterval());
if (paths.size() == 0) {
continue;
}
AvgQueryPlan subPlan = new AvgQueryPlan(
plan.getPathsByInterval(info.getTimeSeriesInterval()),
paths,
Math.max(plan.getStartTime(), info.getTimeInterval().getStartTime()),
Math.min(plan.getEndTime(), info.getTimeInterval().getEndTime()),
info.getStorageUnit()
Expand Down

0 comments on commit 859175f

Please sign in to comment.