This is an automated email from the ASF dual-hosted git repository.
jackietien 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 c5e8ec4c1d [IOTDB-5432] Use freemarker to generate eventWindow and
eventWindowManager
c5e8ec4c1d is described below
commit c5e8ec4c1d66fddf1f0a577a60cc3cc694b05cd6
Author: AACEPT <[email protected]>
AuthorDate: Sat Jan 28 11:25:40 2023 +0800
[IOTDB-5432] Use freemarker to generate eventWindow and eventWindowManager
---
server/src/main/codegen/config.fmpp | 1 +
.../{config.fmpp => dataModel/CompareType.tdd} | 17 +++---
.../src/main/codegen/templates/evEventWindow.ftl | 64 +++++++++++++++++++++
.../templates/evEventWindowManager.ftl} | 44 +++++++++++++--
.../templates/eventWindow.ftl} | 26 ++++++---
.../main/codegen/templates/eventWindowManager.ftl | 56 ++++++++++++++++++
.../operator/window/EqualEventBooleanWindow.java | 37 ------------
.../window/EqualEventBooleanWindowManager.java | 64 ---------------------
.../operator/window/EqualEventDoubleWindow.java | 37 ------------
.../window/EqualEventDoubleWindowManager.java | 64 ---------------------
.../operator/window/EqualEventFloatWindow.java | 37 ------------
.../window/EqualEventFloatWindowManager.java | 64 ---------------------
.../operator/window/EqualEventIntWindow.java | 37 ------------
.../window/EqualEventIntWindowManager.java | 63 ---------------------
.../operator/window/EqualEventLongWindow.java | 37 ------------
.../window/EqualEventLongWindowManager.java | 63 ---------------------
.../operator/window/EqualEventTextWindow.java | 37 ------------
.../window/EqualEventTextWindowManager.java | 64 ---------------------
.../operator/window/EventBooleanWindow.java | 66 ----------------------
.../operator/window/EventBooleanWindowManager.java | 46 ---------------
.../operator/window/EventDoubleWindow.java | 66 ----------------------
.../operator/window/EventDoubleWindowManager.java | 46 ---------------
.../operator/window/EventFloatWindow.java | 66 ----------------------
.../operator/window/EventFloatWindowManager.java | 46 ---------------
.../execution/operator/window/EventIntWindow.java | 66 ----------------------
.../operator/window/EventIntWindowManager.java | 46 ---------------
.../execution/operator/window/EventLongWindow.java | 66 ----------------------
.../operator/window/EventLongWindowManager.java | 46 ---------------
.../operator/window/EventTextWindowManager.java | 46 ---------------
.../window/VariationEventDoubleWindow.java | 37 ------------
.../window/VariationEventDoubleWindowManager.java | 66 ----------------------
.../operator/window/VariationEventFloatWindow.java | 37 ------------
.../operator/window/VariationEventIntWindow.java | 37 ------------
.../window/VariationEventIntWindowManager.java | 66 ----------------------
.../operator/window/VariationEventLongWindow.java | 37 ------------
.../window/VariationEventLongWindowManager.java | 66 ----------------------
.../operator/window/WindowManagerFactory.java | 2 +-
37 files changed, 190 insertions(+), 1576 deletions(-)
diff --git a/server/src/main/codegen/config.fmpp
b/server/src/main/codegen/config.fmpp
index 123ab45624..2112c45936 100644
--- a/server/src/main/codegen/config.fmpp
+++ b/server/src/main/codegen/config.fmpp
@@ -19,6 +19,7 @@
data: {
allDataTypes: tdd(../dataModel/AllDataType.tdd),
decimalDataTypes: tdd(../dataModel/DecimalDataType.tdd),
+ compareTypes: tdd(../dataModel/CompareType.tdd)
}
freemarkerLinks: {
includes: includes/
diff --git a/server/src/main/codegen/config.fmpp
b/server/src/main/codegen/dataModel/CompareType.tdd
similarity index 82%
copy from server/src/main/codegen/config.fmpp
copy to server/src/main/codegen/dataModel/CompareType.tdd
index 123ab45624..00eb05280c 100644
--- a/server/src/main/codegen/config.fmpp
+++ b/server/src/main/codegen/dataModel/CompareType.tdd
@@ -16,10 +16,13 @@
* limitations under the License.
-->
-data: {
- allDataTypes: tdd(../dataModel/AllDataType.tdd),
- decimalDataTypes: tdd(../dataModel/DecimalDataType.tdd),
-}
-freemarkerLinks: {
- includes: includes/
-}
+{
+ "types": [
+ {
+ "compareType": "equal"
+ }
+ ,{
+ "compareType": "variation"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/server/src/main/codegen/templates/evEventWindow.ftl
b/server/src/main/codegen/templates/evEventWindow.ftl
new file mode 100644
index 0000000000..a1383ab10c
--- /dev/null
+++ b/server/src/main/codegen/templates/evEventWindow.ftl
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+<@pp.dropOutputFile />
+
+<#list allDataTypes.types as dataType>
+ <#list compareTypes.types as compareType>
+
+ <#if compareType.compareType == "variation">
+ <#if dataType.dataType == "boolean">
+ <#continue>
+ </#if>
+ <#if dataType.dataType == "Binary">
+ <#continue>
+ </#if>
+ </#if>
+
+ <#assign className =
"${compareType.compareType?cap_first}Event${dataType.dataType?cap_first}Window">
+ <@pp.changeOutputFile
name="/org/apache/iotdb/db/mpp/execution/operator/window/${className}.java" />
+
+package org.apache.iotdb.db.mpp.execution.operator.window;
+
+import org.apache.iotdb.tsfile.read.common.block.column.Column;
+
+public class ${className} extends Event${dataType.dataType?cap_first}Window {
+
+ public ${className}(EventWindowParameter eventWindowParameter) {
+ super(eventWindowParameter);
+ }
+
+ @Override
+ public boolean satisfy(Column column, int index) {
+ if (!initializedEventValue) {
+ return true;
+ }
+ <#if compareType.compareType == "equal">
+ <#if dataType.dataType == "Binary">
+ return column.get${dataType.dataType?cap_first}(index).equals(eventValue);
+ <#else>
+ return column.get${dataType.dataType?cap_first}(index) == eventValue;
+ </#if>
+ <#else>
+ return Math.abs(column.get${dataType.dataType?cap_first}(index) -
eventValue) <= eventWindowParameter.getDelta();
+ </#if>
+ }
+}
+
+ </#list>
+</#list>
\ No newline at end of file
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindowManager.java
b/server/src/main/codegen/templates/evEventWindowManager.ftl
similarity index 56%
rename from
server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindowManager.java
rename to server/src/main/codegen/templates/evEventWindowManager.ftl
index a01bb879ec..719076e429 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindowManager.java
+++ b/server/src/main/codegen/templates/evEventWindowManager.ftl
@@ -16,19 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
+<@pp.dropOutputFile />
+
+<#list allDataTypes.types as dataType>
+ <#list compareTypes.types as compareType>
+
+ <#if compareType.compareType == "variation">
+ <#if dataType.dataType == "boolean">
+ <#continue>
+ </#if>
+ <#if dataType.dataType == "Binary">
+ <#continue>
+ </#if>
+ </#if>
+
+ <#assign className =
"${compareType.compareType?cap_first}Event${dataType.dataType?cap_first}WindowManager">
+ <#assign windowName =
"${compareType.compareType?cap_first}Event${dataType.dataType?cap_first}Window">
+ <@pp.changeOutputFile
name="/org/apache/iotdb/db/mpp/execution/operator/window/${className}.java" />
package org.apache.iotdb.db.mpp.execution.operator.window;
import org.apache.iotdb.tsfile.read.common.block.TsBlock;
import org.apache.iotdb.tsfile.read.common.block.column.Column;
import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
+<#if dataType.dataType == "Binary">
+import org.apache.iotdb.tsfile.utils.Binary;
+</#if>
-public class VariationEventFloatWindowManager extends EventFloatWindowManager {
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+public class ${className} extends
Event${dataType.dataType?cap_first}WindowManager {
- public VariationEventFloatWindowManager(
+ public ${className}(
EventWindowParameter eventWindowParameter, boolean ascending) {
super(eventWindowParameter, ascending);
- eventWindow = new VariationEventFloatWindow(eventWindowParameter);
+ eventWindow = new ${windowName}(eventWindowParameter);
}
@Override
@@ -44,11 +67,19 @@ public class VariationEventFloatWindowManager extends
EventFloatWindowManager {
Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
TimeColumn timeColumn = inputTsBlock.getTimeColumn();
int i = 0, size = inputTsBlock.getPositionCount();
- float previousEventValue = ((VariationEventFloatWindow)
eventWindow).getPreviousEventValue();
+ ${dataType.dataType} previousEventValue = ((${windowName})
eventWindow).getPreviousEventValue();
for (; i < size; i++) {
+ <#if compareType.compareType == "equal">
+ <#if dataType.dataType == "Binary">
+ if (!controlColumn.isNull(i) &&
!controlColumn.get${dataType.dataType?cap_first}(i).equals(previousEventValue))
{
+ <#else>
+ if (!controlColumn.isNull(i) &&
controlColumn.get${dataType.dataType?cap_first}(i) != previousEventValue) {
+ </#if>
+ <#else>
if (!controlColumn.isNull(i)
- && Math.abs(controlColumn.getFloat(i) - previousEventValue)
+ && Math.abs(controlColumn.get${dataType.dataType?cap_first}(i) -
previousEventValue)
> eventWindowParameter.getDelta()) {
+ </#if>
break;
}
// judge whether we need update endTime
@@ -64,3 +95,6 @@ public class VariationEventFloatWindowManager extends
EventFloatWindowManager {
return inputTsBlock.subTsBlock(i);
}
}
+
+ </#list>
+</#list>
\ No newline at end of file
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindow.java
b/server/src/main/codegen/templates/eventWindow.ftl
similarity index 69%
rename from
server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindow.java
rename to server/src/main/codegen/templates/eventWindow.ftl
index 219ec490f3..d07cb9e919 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindow.java
+++ b/server/src/main/codegen/templates/eventWindow.ftl
@@ -16,19 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
+<@pp.dropOutputFile />
+<#list allDataTypes.types as type>
+
+ <#assign className = "Event${type.dataType?cap_first}Window">
+ <@pp.changeOutputFile
name="/org/apache/iotdb/db/mpp/execution/operator/window/${className}.java" />
package org.apache.iotdb.db.mpp.execution.operator.window;
import org.apache.iotdb.tsfile.read.common.block.column.Column;
+<#if type.dataType == "Binary">
import org.apache.iotdb.tsfile.utils.Binary;
+</#if>
-public abstract class EventTextWindow extends EventWindow {
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+public abstract class ${className} extends EventWindow {
- protected Binary eventValue;
+ protected ${type.dataType} eventValue;
- private Binary previousEventValue;
+ private ${type.dataType} previousEventValue;
- public EventTextWindow(EventWindowParameter eventWindowParameter) {
+ public ${className}(EventWindowParameter eventWindowParameter) {
super(eventWindowParameter);
}
@@ -52,16 +62,18 @@ public abstract class EventTextWindow extends EventWindow {
if (!initializedEventValue) {
startTime = currentTime;
endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getBinary(index);
+ eventValue =
controlTimeAndValueColumn[0].get${type.dataType?cap_first}(index);
initializedEventValue = true;
}
}
- public Binary getEventValue() {
+ public ${type.dataType} getEventValue() {
return eventValue;
}
- public Binary getPreviousEventValue() {
+ public ${type.dataType} getPreviousEventValue() {
return previousEventValue;
}
}
+
+</#list>
\ No newline at end of file
diff --git a/server/src/main/codegen/templates/eventWindowManager.ftl
b/server/src/main/codegen/templates/eventWindowManager.ftl
new file mode 100644
index 0000000000..6084d5e478
--- /dev/null
+++ b/server/src/main/codegen/templates/eventWindowManager.ftl
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+<@pp.dropOutputFile />
+
+<#list allDataTypes.types as type>
+
+ <#assign className = "Event${type.dataType?cap_first}WindowManager">
+ <@pp.changeOutputFile
name="/org/apache/iotdb/db/mpp/execution/operator/window/${className}.java" />
+package org.apache.iotdb.db.mpp.execution.operator.window;
+
+import org.apache.iotdb.db.mpp.aggregation.Aggregator;
+import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
+import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
+
+import java.util.List;
+
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+public abstract class ${className} extends EventWindowManager {
+
+ public ${className}(EventWindowParameter eventWindowParameter, boolean
ascending) {
+ super(eventWindowParameter, ascending);
+ }
+
+ @Override
+ public void appendAggregationResult(
+ TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
+ // Append aggregation results to valueColumnBuilders.
+ ColumnBuilder[] columnBuilders =
+ appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
+ // Judge whether we need output event column.
+ if (eventWindowParameter.isNeedOutputEvent()) {
+ columnBuilders[columnBuilders.length -
1].write${type.dataType?cap_first}(
+ ((Event${type.dataType?cap_first}Window)
eventWindow).getEventValue());
+ }
+ }
+}
+
+</#list>
\ No newline at end of file
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindow.java
deleted file mode 100644
index 78258c20c2..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventBooleanWindow extends EventBooleanWindow {
-
- public EqualEventBooleanWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getBoolean(index) == eventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindowManager.java
deleted file mode 100644
index b1da72bff4..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventBooleanWindowManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class EqualEventBooleanWindowManager extends EventBooleanWindowManager {
-
- public EqualEventBooleanWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventBooleanWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- boolean previousEventValue = ((EqualEventBooleanWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) && controlColumn.getBoolean(i) !=
previousEventValue) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindow.java
deleted file mode 100644
index aae3164dd2..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventDoubleWindow extends EventDoubleWindow {
-
- public EqualEventDoubleWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getDouble(index) == eventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindowManager.java
deleted file mode 100644
index c9b225f80e..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventDoubleWindowManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class EqualEventDoubleWindowManager extends EventDoubleWindowManager {
-
- public EqualEventDoubleWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventDoubleWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- double previousEventValue = ((EqualEventDoubleWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) && controlColumn.getDouble(i) !=
previousEventValue) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindow.java
deleted file mode 100644
index 9fb5b48150..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventFloatWindow extends EventFloatWindow {
-
- public EqualEventFloatWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getFloat(index) == eventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindowManager.java
deleted file mode 100644
index 1d5840c1d5..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventFloatWindowManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class EqualEventFloatWindowManager extends EventFloatWindowManager {
-
- public EqualEventFloatWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventFloatWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- float previousEventValue = ((EqualEventFloatWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) && controlColumn.getFloat(i) !=
previousEventValue) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindow.java
deleted file mode 100644
index 5b8e8230c7..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventIntWindow extends EventIntWindow {
-
- public EqualEventIntWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getInt(index) == eventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindowManager.java
deleted file mode 100644
index ef866dad43..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventIntWindowManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class EqualEventIntWindowManager extends EventIntWindowManager {
-
- public EqualEventIntWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventIntWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- int previousEventValue = ((EqualEventIntWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) && controlColumn.getInt(i) !=
previousEventValue) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindow.java
deleted file mode 100644
index d69d3cf7a2..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventLongWindow extends EventLongWindow {
-
- public EqualEventLongWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getLong(index) == eventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindowManager.java
deleted file mode 100644
index 6e330b2a5f..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventLongWindowManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class EqualEventLongWindowManager extends EventLongWindowManager {
-
- public EqualEventLongWindowManager(EventWindowParameter
eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventLongWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- long previousEventValue = ((EqualEventLongWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) && controlColumn.getLong(i) !=
previousEventValue) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindow.java
deleted file mode 100644
index 316702bb92..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class EqualEventTextWindow extends EventTextWindow {
-
- public EqualEventTextWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return column.getBinary(index).equals(eventValue);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindowManager.java
deleted file mode 100644
index 8882d15b6a..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EqualEventTextWindowManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-import org.apache.iotdb.tsfile.utils.Binary;
-
-public class EqualEventTextWindowManager extends EventTextWindowManager {
-
- public EqualEventTextWindowManager(EventWindowParameter
eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new EqualEventTextWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- Binary previousEventValue = ((EqualEventTextWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i) &&
!controlColumn.getBinary(i).equals(previousEventValue)) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindow.java
deleted file mode 100644
index 9f3d8e7d22..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindow.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public abstract class EventBooleanWindow extends EventWindow {
-
- protected boolean eventValue;
-
- private boolean previousEventValue;
-
- public EventBooleanWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public void updatePreviousEventValue() {
- previousEventValue = eventValue;
- }
-
- @Override
- public void mergeOnePoint(Column[] controlTimeAndValueColumn, int index) {
- long currentTime = controlTimeAndValueColumn[1].getLong(index);
- // judge whether we need update startTime
- if (startTime > currentTime) {
- startTime = currentTime;
- }
- // judge whether we need update endTime
- if (endTime < currentTime) {
- endTime = currentTime;
- }
- // judge whether we need initialize eventValue
- if (!initializedEventValue) {
- startTime = currentTime;
- endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getBoolean(index);
- initializedEventValue = true;
- }
- }
-
- public boolean getEventValue() {
- return eventValue;
- }
-
- public boolean getPreviousEventValue() {
- return previousEventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindowManager.java
deleted file mode 100644
index c291a3484e..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventBooleanWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventBooleanWindowManager extends EventWindowManager {
-
- public EventBooleanWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeBoolean(
- ((EventBooleanWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindow.java
deleted file mode 100644
index 611d040aff..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindow.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public abstract class EventDoubleWindow extends EventWindow {
-
- protected double eventValue;
-
- private double previousEventValue;
-
- public EventDoubleWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public void updatePreviousEventValue() {
- previousEventValue = eventValue;
- }
-
- @Override
- public void mergeOnePoint(Column[] controlTimeAndValueColumn, int index) {
- long currentTime = controlTimeAndValueColumn[1].getLong(index);
- // judge whether we need update startTime
- if (startTime > currentTime) {
- startTime = currentTime;
- }
- // judge whether we need update endTime
- if (endTime < currentTime) {
- endTime = currentTime;
- }
- // judge whether we need initialize eventValue
- if (!initializedEventValue) {
- startTime = currentTime;
- endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getDouble(index);
- initializedEventValue = true;
- }
- }
-
- public double getEventValue() {
- return eventValue;
- }
-
- public double getPreviousEventValue() {
- return previousEventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindowManager.java
deleted file mode 100644
index 227c9312eb..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventDoubleWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventDoubleWindowManager extends EventWindowManager {
-
- public EventDoubleWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeDouble(
- ((EventDoubleWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindow.java
deleted file mode 100644
index 666a54ba0c..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindow.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public abstract class EventFloatWindow extends EventWindow {
-
- protected float eventValue;
-
- private float previousEventValue;
-
- public EventFloatWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public void updatePreviousEventValue() {
- previousEventValue = eventValue;
- }
-
- @Override
- public void mergeOnePoint(Column[] controlTimeAndValueColumn, int index) {
- long currentTime = controlTimeAndValueColumn[1].getLong(index);
- // judge whether we need update startTime
- if (startTime > currentTime) {
- startTime = currentTime;
- }
- // judge whether we need update endTime
- if (endTime < currentTime) {
- endTime = currentTime;
- }
- // judge whether we need initialize eventValue
- if (!initializedEventValue) {
- startTime = currentTime;
- endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getFloat(index);
- initializedEventValue = true;
- }
- }
-
- public float getEventValue() {
- return eventValue;
- }
-
- public float getPreviousEventValue() {
- return previousEventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindowManager.java
deleted file mode 100644
index d4904760c1..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventFloatWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventFloatWindowManager extends EventWindowManager {
-
- public EventFloatWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeFloat(
- ((EventFloatWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindow.java
deleted file mode 100644
index e73e186e70..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindow.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public abstract class EventIntWindow extends EventWindow {
-
- protected int eventValue;
-
- private int previousEventValue;
-
- public EventIntWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public void updatePreviousEventValue() {
- previousEventValue = eventValue;
- }
-
- @Override
- public void mergeOnePoint(Column[] controlTimeAndValueColumn, int index) {
- long currentTime = controlTimeAndValueColumn[1].getLong(index);
- // judge whether we need update startTime
- if (startTime > currentTime) {
- startTime = currentTime;
- }
- // judge whether we need update endTime
- if (endTime < currentTime) {
- endTime = currentTime;
- }
- // judge whether we need initialize eventValue
- if (!initializedEventValue) {
- startTime = currentTime;
- endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getInt(index);
- initializedEventValue = true;
- }
- }
-
- public int getEventValue() {
- return eventValue;
- }
-
- public int getPreviousEventValue() {
- return previousEventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindowManager.java
deleted file mode 100644
index a7233037f3..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventIntWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventIntWindowManager extends EventWindowManager {
-
- public EventIntWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeInt(
- ((EventIntWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindow.java
deleted file mode 100644
index e9b8d8425d..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindow.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public abstract class EventLongWindow extends EventWindow {
-
- protected long eventValue;
-
- private long previousEventValue;
-
- public EventLongWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public void updatePreviousEventValue() {
- previousEventValue = eventValue;
- }
-
- @Override
- public void mergeOnePoint(Column[] controlTimeAndValueColumn, int index) {
- long currentTime = controlTimeAndValueColumn[1].getLong(index);
- // judge whether we need update startTime
- if (startTime > currentTime) {
- startTime = currentTime;
- }
- // judge whether we need update endTime
- if (endTime < currentTime) {
- endTime = currentTime;
- }
- // judge whether we need initialize eventValue
- if (!initializedEventValue) {
- startTime = currentTime;
- endTime = currentTime;
- eventValue = controlTimeAndValueColumn[0].getLong(index);
- initializedEventValue = true;
- }
- }
-
- public long getEventValue() {
- return eventValue;
- }
-
- public long getPreviousEventValue() {
- return previousEventValue;
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindowManager.java
deleted file mode 100644
index 2f02142e10..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventLongWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventLongWindowManager extends EventWindowManager {
-
- public EventLongWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeLong(
- ((EventLongWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindowManager.java
deleted file mode 100644
index 04b2ed7912..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/EventTextWindowManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.db.mpp.aggregation.Aggregator;
-import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.ColumnBuilder;
-
-import java.util.List;
-
-public abstract class EventTextWindowManager extends EventWindowManager {
-
- public EventTextWindowManager(EventWindowParameter eventWindowParameter,
boolean ascending) {
- super(eventWindowParameter, ascending);
- }
-
- @Override
- public void appendAggregationResult(
- TsBlockBuilder resultTsBlockBuilder, List<Aggregator> aggregators) {
- // Append aggregation results to valueColumnBuilders.
- ColumnBuilder[] columnBuilders =
- appendOriginAggregationResult(resultTsBlockBuilder, aggregators);
- // Judge whether we need output event column.
- if (eventWindowParameter.isNeedOutputEvent()) {
- columnBuilders[columnBuilders.length - 1].writeBinary(
- ((EventTextWindow) eventWindow).getEventValue());
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindow.java
deleted file mode 100644
index 583e40ee71..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class VariationEventDoubleWindow extends EventDoubleWindow {
-
- public VariationEventDoubleWindow(EventWindowParameter eventWindowParameter)
{
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return Math.abs(column.getDouble(index) - eventValue) <=
eventWindowParameter.getDelta();
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindowManager.java
deleted file mode 100644
index c6093c5d01..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventDoubleWindowManager.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class VariationEventDoubleWindowManager extends
EventDoubleWindowManager {
-
- public VariationEventDoubleWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new VariationEventDoubleWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- double previousEventValue = ((VariationEventDoubleWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i)
- && Math.abs(controlColumn.getDouble(i) - previousEventValue)
- > eventWindowParameter.getDelta()) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindow.java
deleted file mode 100644
index 65df9a500f..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventFloatWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class VariationEventFloatWindow extends EventFloatWindow {
-
- public VariationEventFloatWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return Math.abs(column.getFloat(index) - eventValue) <=
eventWindowParameter.getDelta();
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindow.java
deleted file mode 100644
index a2248c4af9..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class VariationEventIntWindow extends EventIntWindow {
-
- public VariationEventIntWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return Math.abs(column.getInt(index) - eventValue) <=
eventWindowParameter.getDelta();
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindowManager.java
deleted file mode 100644
index 1698cd2557..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventIntWindowManager.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class VariationEventIntWindowManager extends EventIntWindowManager {
-
- public VariationEventIntWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new VariationEventIntWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- int previousEventValue = ((VariationEventIntWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i)
- && Math.abs(controlColumn.getInt(i) - previousEventValue)
- > eventWindowParameter.getDelta()) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindow.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindow.java
deleted file mode 100644
index 192eab4f8c..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-
-public class VariationEventLongWindow extends EventLongWindow {
-
- public VariationEventLongWindow(EventWindowParameter eventWindowParameter) {
- super(eventWindowParameter);
- }
-
- @Override
- public boolean satisfy(Column column, int index) {
- if (!initializedEventValue) {
- return true;
- }
- return Math.abs(column.getLong(index) - eventValue) <=
eventWindowParameter.getDelta();
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindowManager.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindowManager.java
deleted file mode 100644
index 923e526047..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/VariationEventLongWindowManager.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.mpp.execution.operator.window;
-
-import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.TimeColumn;
-
-public class VariationEventLongWindowManager extends EventLongWindowManager {
-
- public VariationEventLongWindowManager(
- EventWindowParameter eventWindowParameter, boolean ascending) {
- super(eventWindowParameter, ascending);
- eventWindow = new VariationEventLongWindow(eventWindowParameter);
- }
-
- @Override
- public TsBlock skipPointsOutOfCurWindow(TsBlock inputTsBlock) {
- if (!needSkip) {
- return inputTsBlock;
- }
-
- if (inputTsBlock == null || inputTsBlock.isEmpty()) {
- return inputTsBlock;
- }
-
- Column controlColumn =
inputTsBlock.getColumn(eventWindowParameter.getControlColumnIndex());
- TimeColumn timeColumn = inputTsBlock.getTimeColumn();
- int i = 0, size = inputTsBlock.getPositionCount();
- long previousEventValue = ((VariationEventLongWindow)
eventWindow).getPreviousEventValue();
- for (; i < size; i++) {
- if (!controlColumn.isNull(i)
- && Math.abs(controlColumn.getLong(i) - previousEventValue)
- > eventWindowParameter.getDelta()) {
- break;
- }
- // judge whether we need update endTime
- long currentTime = timeColumn.getLong(i);
- if (eventWindow.getEndTime() < currentTime) {
- eventWindow.setEndTime(currentTime);
- }
- }
- // we can create a new window beginning at index i of inputTsBlock
- if (i < size) {
- needSkip = false;
- }
- return inputTsBlock.subTsBlock(i);
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/WindowManagerFactory.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/WindowManagerFactory.java
index bb7bf9dc6c..78bcfd07b9 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/WindowManagerFactory.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/window/WindowManagerFactory.java
@@ -52,7 +52,7 @@ public class WindowManagerFactory {
case DOUBLE:
return new EqualEventDoubleWindowManager(eventWindowParameter,
ascending);
case TEXT:
- return new EqualEventTextWindowManager(eventWindowParameter,
ascending);
+ return new EqualEventBinaryWindowManager(eventWindowParameter,
ascending);
case BOOLEAN:
return new EqualEventBooleanWindowManager(eventWindowParameter,
ascending);
default: