This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 9b5361c1742 Pipe: AggregateProcessor: Fixed the bug that processor may
not change the database prefix when output is from another database's
processor's input & Fixed heartbeat output not pipe local and non-atomic bug &
Fixed new processor wipe out states bug (#12338)
9b5361c1742 is described below
commit 9b5361c1742e6683a31ac1e54095c524be2d8217
Author: Caideyipi <[email protected]>
AuthorDate: Mon Apr 15 20:25:12 2024 +0800
Pipe: AggregateProcessor: Fixed the bug that processor may not change the
database prefix when output is from another database's processor's input &
Fixed heartbeat output not pipe local and non-atomic bug & Fixed new processor
wipe out states bug (#12338)
---
.../processor/aggregate/AggregateProcessor.java | 106 ++++++++++++++-------
.../aggregate/TimeSeriesRuntimeState.java | 31 +++---
.../window/datastructure/TimeSeriesWindow.java | 42 ++++----
.../window/datastructure/WindowOutput.java | 6 +-
.../processor/TumblingWindowingProcessor.java | 12 ++-
5 files changed, 123 insertions(+), 74 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/AggregateProcessor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/AggregateProcessor.java
index 9aa7eef8722..baa34101e9c 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/AggregateProcessor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/AggregateProcessor.java
@@ -104,11 +104,11 @@ public class AggregateProcessor implements PipeProcessor {
private static final String WINDOWING_PROCESSOR_SUFFIX =
"-windowing-processor";
private String pipeName;
- private String database;
+ private String databaseWithPathSeparator;
private PipeTaskMeta pipeTaskMeta;
private long outputMaxDelayMilliseconds;
private long outputMinReportIntervalMilliseconds;
- private String outputDatabase;
+ private String outputDatabaseWithPathSeparator;
private final Map<String, AggregatedResultOperator> outputName2OperatorMap =
new HashMap<>();
private final Map<String, Supplier<IntermediateResultOperator>>
@@ -116,6 +116,8 @@ public class AggregateProcessor implements PipeProcessor {
private final Map<String, String> systemParameters = new HashMap<>();
private static final Map<String, Integer> pipeName2referenceCountMap = new
ConcurrentHashMap<>();
+ private static final Map<String, AtomicLong>
pipeName2LastValueReceiveTimeMap =
+ new ConcurrentHashMap<>();
private static final ConcurrentMap<
String, ConcurrentMap<String,
AtomicReference<TimeSeriesRuntimeState>>>
pipeName2timeSeries2TimeSeriesRuntimeStateMap = new
ConcurrentHashMap<>();
@@ -123,13 +125,11 @@ public class AggregateProcessor implements PipeProcessor {
private AbstractWindowingProcessor windowingProcessor;
private final List<AbstractOperatorProcessor> operatorProcessors = new
ArrayList<>();
- private static final AtomicLong lastValueReceiveTime = new AtomicLong(0);
-
// Static values, calculated on initialization
private String[] columnNameStringList;
@Override
- public void validate(PipeParameterValidator validator) throws Exception {
+ public void validate(final PipeParameterValidator validator) throws
Exception {
final PipeParameters parameters = validator.getParameters();
validator
.validate(
@@ -163,49 +163,56 @@ public class AggregateProcessor implements PipeProcessor {
PROCESSOR_OUTPUT_MEASUREMENTS_KEY,
PROCESSOR_OUTPUT_MEASUREMENTS_DEFAULT_VALUE));
}
- private boolean isLegalMeasurement(String measurement) {
+ private boolean isLegalMeasurement(final String measurement) {
try {
PathUtils.isLegalPath("root." + measurement);
- } catch (IllegalPathException e) {
+ } catch (final IllegalPathException e) {
return false;
}
return measurement.startsWith("`") && measurement.endsWith("`") ||
!measurement.contains(".");
}
@Override
- public void customize(PipeParameters parameters,
PipeProcessorRuntimeConfiguration configuration)
+ public void customize(
+ final PipeParameters parameters, final PipeProcessorRuntimeConfiguration
configuration)
throws Exception {
pipeName = configuration.getRuntimeEnvironment().getPipeName();
pipeName2referenceCountMap.compute(
pipeName, (name, count) -> Objects.nonNull(count) ? count + 1 : 1);
- pipeName2timeSeries2TimeSeriesRuntimeStateMap.put(pipeName, new
ConcurrentHashMap<>());
+ pipeName2timeSeries2TimeSeriesRuntimeStateMap.putIfAbsent(pipeName, new
ConcurrentHashMap<>());
- database =
+ databaseWithPathSeparator =
StorageEngine.getInstance()
- .getDataRegion(
- new DataRegionId(
- ((PipeTaskProcessorRuntimeEnvironment)
configuration.getRuntimeEnvironment())
- .getRegionId()))
- .getDatabaseName();
+ .getDataRegion(
+ new DataRegionId(
+ ((PipeTaskProcessorRuntimeEnvironment)
+ configuration.getRuntimeEnvironment())
+ .getRegionId()))
+ .getDatabaseName()
+ + TsFileConstant.PATH_SEPARATOR;
pipeTaskMeta =
((PipeTaskProcessorRuntimeEnvironment)
configuration.getRuntimeEnvironment())
.getPipeTaskMeta();
// Load parameters
- long outputMaxDelaySeconds =
+ final long outputMaxDelaySeconds =
parameters.getLongOrDefault(
PROCESSOR_OUTPUT_MAX_DELAY_SECONDS_KEY,
PROCESSOR_OUTPUT_MAX_DELAY_SECONDS_DEFAULT_VALUE);
+ // The output max delay milliseconds must be set to at least 1
+ // to guarantee the correctness of the CAS in last receive time
outputMaxDelayMilliseconds =
- outputMaxDelaySeconds < 0 ? Long.MAX_VALUE : outputMaxDelaySeconds *
1000;
+ outputMaxDelaySeconds < 0 ? Long.MAX_VALUE :
Math.max(outputMaxDelaySeconds * 1000, 1);
outputMinReportIntervalMilliseconds =
parameters.getLongOrDefault(
PROCESSOR_OUTPUT_MIN_REPORT_INTERVAL_SECONDS_KEY,
PROCESSOR_OUTPUT_MIN_REPORT_INTERVAL_SECONDS_DEFAULT_VALUE)
* 1000;
- outputDatabase =
+ final String outputDatabase =
parameters.getStringOrDefault(
PROCESSOR_OUTPUT_DATABASE_KEY,
PROCESSOR_OUTPUT_DATABASE_DEFAULT_VALUE);
+ outputDatabaseWithPathSeparator =
+ outputDatabase.isEmpty() ? outputDatabase : outputDatabase +
TsFileConstant.PATH_SEPARATOR;
// Set output name
final List<String> operatorNameList =
@@ -240,7 +247,7 @@ public class AggregateProcessor implements PipeProcessor {
// logic.
final Set<String> declaredIntermediateResultSet = new HashSet<>();
final PipeDataRegionPluginAgent agent = PipeAgent.plugin().dataRegion();
- for (String pipePluginName :
+ for (final String pipePluginName :
agent.getSubProcessorNamesWithSpecifiedParent(AbstractOperatorProcessor.class))
{
// Children are allowed to validate and configure the computational logic
// from the same parameters other than processor name
@@ -328,7 +335,7 @@ public class AggregateProcessor implements PipeProcessor {
final TimeWindowStateProgressIndex timeWindowStateProgressIndex =
(TimeWindowStateProgressIndex) index;
- for (Map.Entry<String, Pair<Long, ByteBuffer>> entry :
+ for (final Map.Entry<String, Pair<Long, ByteBuffer>> entry :
timeWindowStateProgressIndex.getTimeSeries2TimestampWindowBufferPairMap().entrySet())
{
final AtomicReference<TimeSeriesRuntimeState> stateReference =
pipeName2timeSeries2TimeSeriesRuntimeStateMap
@@ -345,7 +352,7 @@ public class AggregateProcessor implements PipeProcessor {
synchronized (stateReference) {
try {
stateReference.get().restoreTimestampAndWindows(entry.getValue());
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new PipeException("Encountered exception when deserializing
from PipeTaskMeta", e);
}
}
@@ -353,7 +360,8 @@ public class AggregateProcessor implements PipeProcessor {
}
@Override
- public void process(TabletInsertionEvent tabletInsertionEvent,
EventCollector eventCollector)
+ public void process(
+ final TabletInsertionEvent tabletInsertionEvent, final EventCollector
eventCollector)
throws Exception {
if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent)
&& !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) {
@@ -361,7 +369,10 @@ public class AggregateProcessor implements PipeProcessor {
return;
}
- lastValueReceiveTime.set(System.currentTimeMillis());
+ pipeName2LastValueReceiveTimeMap
+ .computeIfAbsent(pipeName, key -> new
AtomicLong(System.currentTimeMillis()))
+ .set(System.currentTimeMillis());
+
final AtomicReference<Exception> exception = new AtomicReference<>();
final TimeWindowStateProgressIndex progressIndex =
new TimeWindowStateProgressIndex(new ConcurrentHashMap<>());
@@ -390,7 +401,7 @@ public class AggregateProcessor implements PipeProcessor {
}
private Map<String, Pair<Long, ByteBuffer>> processRow(
- Row row, RowCollector rowCollector, AtomicReference<Exception>
exception) {
+ final Row row, final RowCollector rowCollector, final
AtomicReference<Exception> exception) {
final Map<String, Pair<Long, ByteBuffer>> resultMap = new HashMap<>();
final long timestamp = row.getTime();
@@ -400,8 +411,15 @@ public class AggregateProcessor implements PipeProcessor {
continue;
}
+ // All the timeSeries we stored are without database here if the
parameters "outputDatabase"
+ // is configured, because we do not support the same timeSeries (all the
same except database)
+ // in that mode, without the database we can save space and prevent
string replacing problems.
final String timeSeries =
- row.getDeviceId() + TsFileConstant.PATH_SEPARATOR +
row.getColumnName(index);
+ (outputDatabaseWithPathSeparator.isEmpty()
+ ? row.getDeviceId()
+ : row.getDeviceId().replaceFirst(databaseWithPathSeparator,
""))
+ + TsFileConstant.PATH_SEPARATOR
+ + row.getColumnName(index);
final AtomicReference<TimeSeriesRuntimeState> stateReference =
pipeName2timeSeries2TimeSeriesRuntimeStateMap
@@ -461,7 +479,7 @@ public class AggregateProcessor implements PipeProcessor {
resultMap.put(timeSeries, result.getRight());
}
}
- } catch (IOException | UnsupportedOperationException e) {
+ } catch (final IOException | UnsupportedOperationException e) {
exception.set(e);
}
}
@@ -470,7 +488,8 @@ public class AggregateProcessor implements PipeProcessor {
}
@Override
- public void process(TsFileInsertionEvent tsFileInsertionEvent,
EventCollector eventCollector)
+ public void process(
+ final TsFileInsertionEvent tsFileInsertionEvent, final EventCollector
eventCollector)
throws Exception {
try {
for (final TabletInsertionEvent tabletInsertionEvent :
@@ -488,8 +507,14 @@ public class AggregateProcessor implements PipeProcessor {
}
@Override
- public void process(Event event, EventCollector eventCollector) throws
Exception {
- if (System.currentTimeMillis() - lastValueReceiveTime.get() >
outputMaxDelayMilliseconds) {
+ public void process(final Event event, final EventCollector eventCollector)
throws Exception {
+ final AtomicLong lastReceiveTime =
+ pipeName2LastValueReceiveTimeMap.computeIfAbsent(
+ pipeName, key -> new AtomicLong(System.currentTimeMillis()));
+
+ final long previousTime = lastReceiveTime.get();
+
+ if (System.currentTimeMillis() - previousTime >
outputMaxDelayMilliseconds) {
final AtomicReference<Exception> exception = new AtomicReference<>();
pipeName2timeSeries2TimeSeriesRuntimeStateMap
@@ -500,11 +525,11 @@ public class AggregateProcessor implements PipeProcessor {
final AtomicReference<TimeSeriesRuntimeState> stateReference =
pipeName2timeSeries2TimeSeriesRuntimeStateMap.get(pipeName).get(timeSeries);
synchronized (stateReference) {
- PipeRowCollector rowCollector = new
PipeRowCollector(pipeTaskMeta, null);
+ final PipeRowCollector rowCollector = new
PipeRowCollector(pipeTaskMeta, null);
try {
collectWindowOutputs(
stateReference.get().forceOutput(), timeSeries,
rowCollector);
- } catch (IOException e) {
+ } catch (final IOException e) {
exception.set(e);
}
rowCollector
@@ -520,10 +545,14 @@ public class AggregateProcessor implements PipeProcessor {
}
});
if (exception.get() != null) {
+ // Retry at the fixed interval
+ lastReceiveTime.set(System.currentTimeMillis());
throw exception.get();
}
// Forbidding emitting results until next data comes
- lastValueReceiveTime.set(Long.MAX_VALUE);
+ // If the last receive time has changed, it means new data has come
+ // thus the next output is needed
+ lastReceiveTime.compareAndSet(previousTime, Long.MAX_VALUE);
}
eventCollector.collect(event);
@@ -539,7 +568,8 @@ public class AggregateProcessor implements PipeProcessor {
* @param collector {@link RowCollector}
*/
public void collectWindowOutputs(
- List<WindowOutput> outputs, String timeSeries, RowCollector collector)
throws IOException {
+ final List<WindowOutput> outputs, final String timeSeries, final
RowCollector collector)
+ throws IOException {
if (Objects.isNull(outputs) || outputs.isEmpty()) {
return;
}
@@ -550,7 +580,7 @@ public class AggregateProcessor implements PipeProcessor {
final List<WindowOutput> distinctOutputs = new ArrayList<>();
outputs.forEach(
output -> {
- long timeStamp = output.getTimestamp();
+ final long timeStamp = output.getTimestamp();
if (timeStamp != lastValue.get()) {
lastValue.set(timeStamp);
distinctOutputs.add(output);
@@ -572,7 +602,7 @@ public class AggregateProcessor implements PipeProcessor {
for (int columnIndex = 0; columnIndex < columnNameStringList.length;
++columnIndex) {
bitMaps[columnIndex] = new BitMap(distinctOutputs.size());
for (int rowIndex = 0; rowIndex < distinctOutputs.size(); ++rowIndex) {
- Map<String, Pair<TSDataType, Object>> aggregatedResults =
+ final Map<String, Pair<TSDataType, Object>> aggregatedResults =
distinctOutputs.get(rowIndex).getAggregatedResults();
if (aggregatedResults.containsKey(columnNameStringList[columnIndex])) {
if (Objects.isNull(valueColumnTypes[columnIndex])) {
@@ -657,7 +687,9 @@ public class AggregateProcessor implements PipeProcessor {
}
final String outputTimeSeries =
- outputDatabase.isEmpty() ? timeSeries :
timeSeries.replaceFirst(database, outputDatabase);
+ outputDatabaseWithPathSeparator.isEmpty()
+ ? timeSeries
+ : outputDatabaseWithPathSeparator + timeSeries;
if (filteredCount == columnNameStringList.length) {
// No filter, collect rows
@@ -744,7 +776,7 @@ public class AggregateProcessor implements PipeProcessor {
if (Objects.nonNull(windowingProcessor)) {
windowingProcessor.close();
}
- for (PipeProcessor operatorProcessor : operatorProcessors) {
+ for (final PipeProcessor operatorProcessor : operatorProcessors) {
operatorProcessor.close();
}
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/TimeSeriesRuntimeState.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/TimeSeriesRuntimeState.java
index 1b0677d0d10..2247a433908 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/TimeSeriesRuntimeState.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/TimeSeriesRuntimeState.java
@@ -60,10 +60,11 @@ public class TimeSeriesRuntimeState {
private final List<WindowOutput> outputList = new ArrayList<>();
public TimeSeriesRuntimeState(
- Map<String, AggregatedResultOperator> aggregatorOutputName2OperatorMap,
- Map<String, Supplier<IntermediateResultOperator>>
intermediateResultName2OperatorSupplierMap,
- Map<String, String> systemParameters,
- AbstractWindowingProcessor windowingProcessor) {
+ final Map<String, AggregatedResultOperator>
aggregatorOutputName2OperatorMap,
+ final Map<String, Supplier<IntermediateResultOperator>>
+ intermediateResultName2OperatorSupplierMap,
+ final Map<String, String> systemParameters,
+ final AbstractWindowingProcessor windowingProcessor) {
this.aggregatorOutputName2OperatorMap = aggregatorOutputName2OperatorMap;
this.intermediateResultName2OperatorSupplierMap =
intermediateResultName2OperatorSupplierMap;
this.systemParameters = systemParameters;
@@ -72,7 +73,8 @@ public class TimeSeriesRuntimeState {
// The following "updateWindows" are the same except for the input value
types
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, boolean value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final boolean value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -117,7 +119,8 @@ public class TimeSeriesRuntimeState {
}
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, int value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final int value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -162,7 +165,8 @@ public class TimeSeriesRuntimeState {
}
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, long value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final long value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -207,7 +211,8 @@ public class TimeSeriesRuntimeState {
}
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, float value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final float value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -252,7 +257,8 @@ public class TimeSeriesRuntimeState {
}
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, double value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final double value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -297,7 +303,8 @@ public class TimeSeriesRuntimeState {
}
public Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> updateWindows(
- long timestamp, String value, long outputMinReportIntervalMilliseconds)
throws IOException {
+ final long timestamp, final String value, final long
outputMinReportIntervalMilliseconds)
+ throws IOException {
Pair<List<WindowOutput>, Pair<Long, ByteBuffer>> output = null;
if (timestamp <= lastReportTimeStamp) {
@@ -351,7 +358,7 @@ public class TimeSeriesRuntimeState {
// interval time to avoid frequent serialization
// Return null if this should not report
private Pair<Long, ByteBuffer> getTimestampWindowBufferPair(
- long outputMinReportIntervalMilliseconds) throws IOException {
+ final long outputMinReportIntervalMilliseconds) throws IOException {
if (currentOpeningWindows.isEmpty()) {
return new Pair<>(lastReportTimeStamp, null);
}
@@ -372,7 +379,7 @@ public class TimeSeriesRuntimeState {
}
}
- public void restoreTimestampAndWindows(Pair<Long, ByteBuffer>
timestampWindowBufferPair)
+ public void restoreTimestampAndWindows(final Pair<Long, ByteBuffer>
timestampWindowBufferPair)
throws IOException {
if (timestampWindowBufferPair.getLeft() <= lastReportTimeStamp) {
// The runtime state may be initialized by different processorSubtasks
on one DataNode
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/TimeSeriesWindow.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/TimeSeriesWindow.java
index eb839ab29de..8139b5e6ee9 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/TimeSeriesWindow.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/TimeSeriesWindow.java
@@ -56,7 +56,8 @@ public class TimeSeriesWindow {
private Object customizedRuntimeValue;
private final AbstractWindowingProcessor processor;
- public TimeSeriesWindow(AbstractWindowingProcessor processor, Object
customizedRuntimeValue) {
+ public TimeSeriesWindow(
+ final AbstractWindowingProcessor processor, final Object
customizedRuntimeValue) {
this.processor = processor;
this.customizedRuntimeValue = customizedRuntimeValue;
}
@@ -67,7 +68,7 @@ public class TimeSeriesWindow {
return timestamp;
}
- public void setTimestamp(long timestamp) {
+ public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
@@ -75,17 +76,18 @@ public class TimeSeriesWindow {
return customizedRuntimeValue;
}
- public void setCustomizedRuntimeValue(Object customizedRuntimeValue) {
+ public void setCustomizedRuntimeValue(final Object customizedRuntimeValue) {
this.customizedRuntimeValue = customizedRuntimeValue;
}
/////////////////////////////// Calculation ///////////////////////////////
public void initWindow(
- Map<String, Supplier<IntermediateResultOperator>>
intermediateResult2OperatorSupplierMap,
- Map<String, AggregatedResultOperator> aggregatedResultOperatorMap,
- Map<String, String> systemParameters) {
- for (Map.Entry<String, Supplier<IntermediateResultOperator>> entry :
+ final Map<String, Supplier<IntermediateResultOperator>>
+ intermediateResult2OperatorSupplierMap,
+ final Map<String, AggregatedResultOperator> aggregatedResultOperatorMap,
+ final Map<String, String> systemParameters) {
+ for (final Map.Entry<String, Supplier<IntermediateResultOperator>> entry :
intermediateResult2OperatorSupplierMap.entrySet()) {
intermediateResultName2tsTypeAndOperatorMap.put(
entry.getKey(), new Pair<>(TSDataType.UNKNOWN,
entry.getValue().get()));
@@ -100,7 +102,8 @@ public class TimeSeriesWindow {
// Return the output and state of the window.
// Return null if the state is normal to avoid boxing.
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, boolean value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final boolean value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -155,7 +158,8 @@ public class TimeSeriesWindow {
}
// The same logic is repeated because java does not support basic type
template :-)
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, int value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final int value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -209,7 +213,8 @@ public class TimeSeriesWindow {
return state.isEmit() ? stateOutputPair : null;
}
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, long value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final long value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -263,7 +268,8 @@ public class TimeSeriesWindow {
return state.isEmit() ? stateOutputPair : null;
}
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, float value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final float value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -317,7 +323,8 @@ public class TimeSeriesWindow {
return state.isEmit() ? stateOutputPair : null;
}
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, double value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final double value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -370,7 +377,8 @@ public class TimeSeriesWindow {
return state.isEmit() ? stateOutputPair : null;
}
- public Pair<WindowState, WindowOutput> updateIntermediateResult(long
timestamp, String value) {
+ public Pair<WindowState, WindowOutput> updateIntermediateResult(
+ final long timestamp, final String value) {
final Pair<WindowState, WindowOutput> stateOutputPair =
processor.updateAndMaySetWindowState(this, timestamp, value);
final WindowState state = stateOutputPair.getLeft();
@@ -434,7 +442,7 @@ public class TimeSeriesWindow {
.orElse(TSDataType.UNKNOWN)));
}
- private Map<String, Pair<TSDataType, Object>>
getAggregatedResults(TSDataType dataType) {
+ private Map<String, Pair<TSDataType, Object>> getAggregatedResults(final
TSDataType dataType) {
// The remaining intermediate results' datatype shall all be equal to this
// If not, return nothing
if (dataType == TSDataType.UNKNOWN
@@ -457,10 +465,10 @@ public class TimeSeriesWindow {
/////////////////////////////// Ser/De logics ///////////////////////////////
- public void serialize(DataOutputStream outputStream) throws IOException {
+ public void serialize(final DataOutputStream outputStream) throws
IOException {
ReadWriteIOUtils.write(timestamp, outputStream);
ReadWriteIOUtils.write(intermediateResultName2tsTypeAndOperatorMap.size(),
outputStream);
- for (Map.Entry<String, Pair<TSDataType, IntermediateResultOperator>> entry
:
+ for (final Map.Entry<String, Pair<TSDataType, IntermediateResultOperator>>
entry :
intermediateResultName2tsTypeAndOperatorMap.entrySet()) {
ReadWriteIOUtils.write(entry.getKey(), outputStream);
entry.getValue().getLeft().serializeTo(outputStream);
@@ -475,7 +483,7 @@ public class TimeSeriesWindow {
// WARNING: We do not support removing intermediate values (e.g.
intermediate values are
// less after the aggregators decreased) or altering windowing processor in
altering aggregate
// processor, only adding intermediate values is permitted.
- public void deserialize(ByteBuffer byteBuffer) throws IOException {
+ public void deserialize(final ByteBuffer byteBuffer) throws IOException {
timestamp = ReadWriteIOUtils.readLong(byteBuffer);
final int size = ReadWriteIOUtils.readInt(byteBuffer);
for (int i = 0; i < size; i++) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/WindowOutput.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/WindowOutput.java
index d957feaa8aa..0622bb8ed23 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/WindowOutput.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/datastructure/WindowOutput.java
@@ -33,7 +33,7 @@ public class WindowOutput {
return timestamp;
}
- public WindowOutput setTimestamp(long timestamp) {
+ public WindowOutput setTimestamp(final long timestamp) {
this.timestamp = timestamp;
return this;
}
@@ -42,7 +42,7 @@ public class WindowOutput {
return progressTime;
}
- public WindowOutput setProgressTime(long progressTime) {
+ public WindowOutput setProgressTime(final long progressTime) {
this.progressTime = progressTime;
return this;
}
@@ -52,7 +52,7 @@ public class WindowOutput {
}
public WindowOutput setAggregatedResults(
- Map<String, Pair<TSDataType, Object>> aggregatedResults) {
+ final Map<String, Pair<TSDataType, Object>> aggregatedResults) {
this.aggregatedResults = aggregatedResults;
return this;
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/processor/TumblingWindowingProcessor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/processor/TumblingWindowingProcessor.java
index 514509b9319..4d7f8ba4700 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/processor/TumblingWindowingProcessor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/aggregate/window/processor/TumblingWindowingProcessor.java
@@ -44,7 +44,7 @@ public class TumblingWindowingProcessor extends
AbstractSimpleTimeWindowingProce
private long slidingInterval;
@Override
- public void validate(PipeParameterValidator validator) throws Exception {
+ public void validate(final PipeParameterValidator validator) throws
Exception {
final PipeParameters parameters = validator.getParameters();
validator.validate(
args -> (long) args > 0,
@@ -54,7 +54,8 @@ public class TumblingWindowingProcessor extends
AbstractSimpleTimeWindowingProce
}
@Override
- public void customize(PipeParameters parameters,
PipeProcessorRuntimeConfiguration configuration)
+ public void customize(
+ final PipeParameters parameters, final PipeProcessorRuntimeConfiguration
configuration)
throws Exception {
slidingBoundaryTime =
parameters.hasAnyAttributes(PROCESSOR_SLIDING_BOUNDARY_TIME_KEY)
@@ -69,7 +70,8 @@ public class TumblingWindowingProcessor extends
AbstractSimpleTimeWindowingProce
}
@Override
- public Set<TimeSeriesWindow> mayAddWindow(List<TimeSeriesWindow> windowList,
long timeStamp) {
+ public Set<TimeSeriesWindow> mayAddWindow(
+ final List<TimeSeriesWindow> windowList, final long timeStamp) {
final long lastTime =
windowList.isEmpty()
? slidingBoundaryTime
@@ -87,7 +89,7 @@ public class TumblingWindowingProcessor extends
AbstractSimpleTimeWindowingProce
@Override
public Pair<WindowState, WindowOutput> updateAndMaySetWindowState(
- TimeSeriesWindow window, long timeStamp) {
+ final TimeSeriesWindow window, final long timeStamp) {
if (timeStamp < window.getTimestamp()) {
return new Pair<>(WindowState.IGNORE_VALUE, null);
}
@@ -102,7 +104,7 @@ public class TumblingWindowingProcessor extends
AbstractSimpleTimeWindowingProce
}
@Override
- public WindowOutput forceOutput(TimeSeriesWindow window) {
+ public WindowOutput forceOutput(final TimeSeriesWindow window) {
return new WindowOutput()
.setTimestamp(window.getTimestamp())
.setProgressTime(window.getTimestamp() + slidingInterval);