You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/12/08 07:19:10 UTC

[iotdb] 01/01: [IOTDB-4832] Introducing freemarker to auto-generate type-specific code (#7880)

This is an automated email from the ASF dual-hosted git repository.

xiangweiwei pushed a commit to branch freemarker1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit df0db5cef4dd95d76500a4f15a679ab5d12063fe
Author: Xiangwei Wei <34...@users.noreply.github.com>
AuthorDate: Thu Dec 8 11:54:35 2022 +0800

    [IOTDB-4832] Introducing freemarker to auto-generate type-specific code (#7880)
    
    (cherry picked from commit 1378ec06b053346ac99444de75eb522ce021560f)
---
 pom.xml                                            |   3 +
 server/pom.xml                                     |  61 +++++++++++
 server/src/main/codegen/config.fmpp                |  25 +++++
 server/src/main/codegen/dataModel/AllDataType.tdd  |  46 +++++++++
 .../src/main/codegen/dataModel/DecimalDataType.tdd |  38 +++++++
 server/src/main/codegen/templates/constantFill.ftl |  76 ++++++++++++++
 server/src/main/codegen/templates/linearFill.ftl   | 112 +++++++++++++++++++++
 server/src/main/codegen/templates/previousFill.ftl |  99 ++++++++++++++++++
 .../process/fill/constant/BinaryConstantFill.java  |  63 ------------
 .../process/fill/constant/BooleanConstantFill.java |  62 ------------
 .../process/fill/constant/DoubleConstantFill.java  |  62 ------------
 .../process/fill/constant/FloatConstantFill.java   |  62 ------------
 .../process/fill/constant/IntConstantFill.java     |  62 ------------
 .../process/fill/constant/LongConstantFill.java    |  62 ------------
 .../process/fill/linear/DoubleLinearFill.java      |  94 -----------------
 .../process/fill/linear/FloatLinearFill.java       |  94 -----------------
 .../process/fill/linear/IntLinearFill.java         |  94 -----------------
 .../process/fill/linear/LongLinearFill.java        |  94 -----------------
 .../process/fill/previous/BinaryPreviousFill.java  |  86 ----------------
 .../process/fill/previous/BooleanPreviousFill.java |  85 ----------------
 .../process/fill/previous/DoublePreviousFill.java  |  85 ----------------
 .../process/fill/previous/FloatPreviousFill.java   |  85 ----------------
 .../process/fill/previous/IntPreviousFill.java     |  85 ----------------
 .../process/fill/previous/LongPreviousFill.java    |  85 ----------------
 24 files changed, 460 insertions(+), 1260 deletions(-)

diff --git a/pom.xml b/pom.xml
index 18355e1f4c..528a43fc59 100644
--- a/pom.xml
+++ b/pom.xml
@@ -225,6 +225,9 @@
         <commons-lang.version>2.6</commons-lang.version>
         <influxdb-java.version>2.21</influxdb-java.version>
         <JTransforms.version>3.1</JTransforms.version>
+        <!-- codegen -->
+        <drill.freemarker.maven.plugin.version>1.17.0</drill.freemarker.maven.plugin.version>
+        <codegen.phase>generate-sources</codegen.phase>
     </properties>
     <!--
         if we claim dependencies in dependencyManagement, then we do not claim
diff --git a/server/pom.xml b/server/pom.xml
index 29924af52a..3c38dd5473 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -296,6 +296,67 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <!-- copy all templates/data in the same location to compile them at once -->
+                        <id>copy-fmpp-resources</id>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/codegen</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/codegen</directory>
+                                    <filtering>false</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- generate sources from fmpp -->
+                <groupId>org.apache.drill.tools</groupId>
+                <artifactId>drill-fmpp-maven-plugin</artifactId>
+                <version>${drill.freemarker.maven.plugin.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-fmpp</id>
+                        <phase>${codegen.phase}</phase>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <configuration>
+                            <config>${project.build.directory}/codegen/config.fmpp</config>
+                            <output>${project.build.directory}/generated-sources/freemarker</output>
+                            <templates>${project.build.directory}/codegen/templates</templates>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>3.2.0</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/freemarker</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <profiles>
diff --git a/server/src/main/codegen/config.fmpp b/server/src/main/codegen/config.fmpp
new file mode 100644
index 0000000000..123ab45624
--- /dev/null
+++ b/server/src/main/codegen/config.fmpp
@@ -0,0 +1,25 @@
+<#--
+* 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.
+-->
+
+data: {
+    allDataTypes: tdd(../dataModel/AllDataType.tdd),
+    decimalDataTypes: tdd(../dataModel/DecimalDataType.tdd),
+}
+freemarkerLinks: {
+    includes: includes/
+}
diff --git a/server/src/main/codegen/dataModel/AllDataType.tdd b/server/src/main/codegen/dataModel/AllDataType.tdd
new file mode 100644
index 0000000000..1089d8c534
--- /dev/null
+++ b/server/src/main/codegen/dataModel/AllDataType.tdd
@@ -0,0 +1,46 @@
+<#--
+* 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.
+-->
+
+{
+  "types": [
+      {
+        "dataType": "boolean",
+        "column": "BooleanColumn"
+      }
+    ,{
+        "dataType": "int",
+        "column": "IntColumn"
+      }
+    ,{
+        "dataType": "long",
+        "column": "LongColumn"
+     }
+    ,{
+         "dataType": "float",
+         "column": "FloatColumn"
+     }
+   ,{
+        "dataType": "double",
+        "column": "DoubleColumn"
+    }
+    ,{
+         "dataType": "Binary",
+         "column": "BinaryColumn"
+     }
+  ]
+}
diff --git a/server/src/main/codegen/dataModel/DecimalDataType.tdd b/server/src/main/codegen/dataModel/DecimalDataType.tdd
new file mode 100644
index 0000000000..28a94a8a7f
--- /dev/null
+++ b/server/src/main/codegen/dataModel/DecimalDataType.tdd
@@ -0,0 +1,38 @@
+<#--
+* 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.
+-->
+
+{
+  "types": [
+      {
+        "dataType": "int",
+        "column": "IntColumn"
+      }
+    ,{
+        "dataType": "long",
+        "column": "LongColumn"
+      }
+    ,{
+        "dataType": "float",
+        "column": "FloatColumn"
+     }
+    ,{
+         "dataType": "double",
+         "column": "DoubleColumn"
+     }
+ ]
+}
diff --git a/server/src/main/codegen/templates/constantFill.ftl b/server/src/main/codegen/templates/constantFill.ftl
new file mode 100644
index 0000000000..f6b427e823
--- /dev/null
+++ b/server/src/main/codegen/templates/constantFill.ftl
@@ -0,0 +1,76 @@
+/*
+* 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 = "${type.dataType?cap_first}ConstantFill">
+  <@pp.changeOutputFile name="/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/${className}.java" />
+package org.apache.iotdb.db.mpp.execution.operator.process.fill.constant;
+
+import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
+import org.apache.iotdb.tsfile.read.common.block.column.${type.column};
+import org.apache.iotdb.tsfile.read.common.block.column.Column;
+import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
+<#if type.dataType == "Binary">
+import org.apache.iotdb.tsfile.utils.Binary;
+</#if>
+
+import java.util.Optional;
+
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+@SuppressWarnings("unused")
+public class ${className} implements IFill {
+
+  // fill value
+  private final ${type.dataType} value;
+  // used for constructing RunLengthEncodedColumn, size of it must be 1
+  private final ${type.dataType}[] valueArray;
+
+  public ${className}(${type.dataType} value) {
+    this.value = value;
+    this.valueArray = new ${type.dataType}[] {value};
+  }
+
+  @Override
+  public Column fill(Column valueColumn) {
+    int size = valueColumn.getPositionCount();
+    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
+    if (!valueColumn.mayHaveNull() || size == 0) {
+      return valueColumn;
+    }
+    // if its values are all null
+    if (valueColumn instanceof RunLengthEncodedColumn) {
+      return new RunLengthEncodedColumn(new ${type.column}(1, Optional.empty(), valueArray), size);
+    } else {
+      ${type.dataType}[] array = new ${type.dataType}[size];
+      for (int i = 0; i < size; i++) {
+        if (valueColumn.isNull(i)) {
+          array[i] = value;
+        } else {
+          array[i] = valueColumn.get${type.dataType?cap_first}(i);
+        }
+      }
+      return new ${type.column}(size, Optional.empty(), array);
+    }
+  }
+}
+
+</#list>
diff --git a/server/src/main/codegen/templates/linearFill.ftl b/server/src/main/codegen/templates/linearFill.ftl
new file mode 100644
index 0000000000..178e92c985
--- /dev/null
+++ b/server/src/main/codegen/templates/linearFill.ftl
@@ -0,0 +1,112 @@
+/*
+* 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 decimalDataTypes.types as type>
+
+  <#assign className = "${type.dataType?cap_first}LinearFill">
+  <@pp.changeOutputFile name="/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/${className}.java" />
+package org.apache.iotdb.db.mpp.execution.operator.process.fill.linear;
+
+import org.apache.iotdb.tsfile.read.common.block.column.Column;
+import org.apache.iotdb.tsfile.read.common.block.column.${type.column};
+import org.apache.iotdb.tsfile.read.common.block.column.${type.column}Builder;
+
+import java.util.Optional;
+
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+@SuppressWarnings("unused")
+public class ${className} extends LinearFill {
+
+  // previous value
+  private ${type.dataType} previousValue;
+  // next non-null value whose time is closest to the current TsBlock's endTime
+  private ${type.dataType} nextValue;
+
+  private ${type.dataType} nextValueInCurrentColumn;
+
+  @Override
+  void fillValue(Column column, int index, Object array) {
+    ((${type.dataType}[]) array)[index] = column.get${type.dataType?cap_first}(index);
+  }
+
+  @Override
+  void fillValue(Object array, int index) {
+    ((${type.dataType}[]) array)[index] = getFilledValue();
+  }
+
+  @Override
+  Object createValueArray(int size) {
+    return new ${type.dataType}[size];
+  }
+
+  @Override
+  Column createNullValueColumn() {
+    return ${type.column}Builder.NULL_VALUE_BLOCK;
+  }
+
+  @Override
+  Column createFilledValueColumn() {
+    ${type.dataType} filledValue = getFilledValue();
+    return new ${type.column}(1, Optional.empty(), new ${type.dataType}[] {filledValue});
+  }
+
+  @Override
+  Column createFilledValueColumn(Object array, boolean[] isNull, boolean hasNullValue, int size) {
+    if (hasNullValue) {
+      return new ${type.column}(size, Optional.of(isNull), (${type.dataType}[]) array);
+    } else {
+      return new ${type.column}(size, Optional.empty(), (${type.dataType}[]) array);
+    }
+  }
+
+  @Override
+  void updatePreviousValue(Column column, int index) {
+    previousValue = column.get${type.dataType?cap_first}(index);
+  }
+
+  @Override
+  void updateNextValue(Column nextValueColumn, int index) {
+    this.nextValue = nextValueColumn.get${type.dataType?cap_first}(index);
+  }
+
+  @Override
+  void updateNextValueInCurrentColumn(Column nextValueColumn, int index) {
+    this.nextValueInCurrentColumn = nextValueColumn.get${type.dataType?cap_first}(index);
+  }
+
+  @Override
+  void updateNextValueInCurrentColumn() {
+    this.nextValueInCurrentColumn = this.nextValue;
+  }
+
+  private ${type.dataType} getFilledValue() {
+    <#if type.dataType == "double">
+    return (previousValue + nextValueInCurrentColumn) / 2.0;
+    <#elseif type.dataType == "float">
+    return (previousValue + nextValueInCurrentColumn) / 2.0f;
+    <#else>
+    return (previousValue + nextValueInCurrentColumn) / 2;
+    </#if>
+  }
+}
+
+</#list>
diff --git a/server/src/main/codegen/templates/previousFill.ftl b/server/src/main/codegen/templates/previousFill.ftl
new file mode 100644
index 0000000000..22c9afece8
--- /dev/null
+++ b/server/src/main/codegen/templates/previousFill.ftl
@@ -0,0 +1,99 @@
+/*
+* 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 = "${type.dataType?cap_first}PreviousFill">
+  <@pp.changeOutputFile name="/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/${className}.java" />
+package org.apache.iotdb.db.mpp.execution.operator.process.fill.previous;
+
+import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
+import org.apache.iotdb.tsfile.read.common.block.column.Column;
+import org.apache.iotdb.tsfile.read.common.block.column.${type.column};
+import org.apache.iotdb.tsfile.read.common.block.column.${type.column}Builder;
+import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
+<#if type.dataType == "Binary">
+  import org.apache.iotdb.tsfile.utils.Binary;
+</#if>
+
+import java.util.Optional;
+
+/*
+* This class is generated using freemarker and the ${.template_name} template.
+*/
+@SuppressWarnings("unused")
+public class ${className} implements IFill {
+
+  // previous value
+  private ${type.dataType} value;
+  // whether previous value is null
+  private boolean previousIsNull = true;
+
+  @Override
+  public Column fill(Column valueColumn) {
+    int size = valueColumn.getPositionCount();
+    // if this valueColumn is empty, just return itself;
+    if (size == 0) {
+      return valueColumn;
+    }
+    // if this valueColumn doesn't have any null value, record the last value, and then return
+    // itself.
+    if (!valueColumn.mayHaveNull()) {
+      previousIsNull = false;
+      // update the value using last non-null value
+      value = valueColumn.get${type.dataType?cap_first}(size - 1);
+      return valueColumn;
+    }
+    // if its values are all null
+    if (valueColumn instanceof RunLengthEncodedColumn) {
+      if (previousIsNull) {
+        return new RunLengthEncodedColumn(${type.column}Builder.NULL_VALUE_BLOCK, size);
+      } else {
+        return new RunLengthEncodedColumn(
+            new ${type.column}(1, Optional.empty(), new ${type.dataType}[] {value}), size);
+      }
+    } else {
+      ${type.dataType}[] array = new ${type.dataType}[size];
+      boolean[] isNull = new boolean[size];
+      // have null value
+      boolean hasNullValue = false;
+      for (int i = 0; i < size; i++) {
+        if (valueColumn.isNull(i)) {
+          if (previousIsNull) {
+            isNull[i] = true;
+            hasNullValue = true;
+          } else {
+            array[i] = value;
+          }
+        } else {
+          array[i] = valueColumn.get${type.dataType?cap_first}(i);
+          value = array[i];
+          previousIsNull = false;
+        }
+      }
+      if (hasNullValue) {
+        return new ${type.column}(size, Optional.of(isNull), array);
+      } else {
+        return new ${type.column}(size, Optional.empty(), array);
+      }
+    }
+  }
+}
+</#list>
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BinaryConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BinaryConstantFill.java
deleted file mode 100644
index f590adced3..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BinaryConstantFill.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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.BinaryColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-import org.apache.iotdb.tsfile.utils.Binary;
-
-import java.util.Optional;
-
-public class BinaryConstantFill implements IFill {
-
-  // fill value
-  private final Binary value;
-  // used for constructing RunLengthEncodedColumn, size of it must be 1
-  private final Binary[] valueArray;
-
-  public BinaryConstantFill(Binary value) {
-    this.value = value;
-    this.valueArray = new Binary[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new BinaryColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      Binary[] array = new Binary[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getBinary(i);
-        }
-      }
-      return new BinaryColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BooleanConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BooleanConstantFill.java
deleted file mode 100644
index 7604248242..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/BooleanConstantFill.java
+++ /dev/null
@@ -1,62 +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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.BooleanColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class BooleanConstantFill implements IFill {
-
-  // fill value
-  private final boolean value;
-  // used for constructing RunLengthEncodedColumn
-  private final boolean[] valueArray;
-
-  public BooleanConstantFill(boolean value) {
-    this.value = value;
-    this.valueArray = new boolean[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new BooleanColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      boolean[] array = new boolean[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getBoolean(i);
-        }
-      }
-      return new BooleanColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/DoubleConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/DoubleConstantFill.java
deleted file mode 100644
index 4615619312..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/DoubleConstantFill.java
+++ /dev/null
@@ -1,62 +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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.DoubleColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class DoubleConstantFill implements IFill {
-
-  // fill value
-  private final double value;
-  // used for constructing RunLengthEncodedColumn
-  private final double[] valueArray;
-
-  public DoubleConstantFill(double value) {
-    this.value = value;
-    this.valueArray = new double[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new DoubleColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      double[] array = new double[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getDouble(i);
-        }
-      }
-      return new DoubleColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/FloatConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/FloatConstantFill.java
deleted file mode 100644
index f7d0dc0f32..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/FloatConstantFill.java
+++ /dev/null
@@ -1,62 +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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.FloatColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class FloatConstantFill implements IFill {
-
-  // fill value
-  private final float value;
-  // used for constructing RunLengthEncodedColumn
-  private final float[] valueArray;
-
-  public FloatConstantFill(float value) {
-    this.value = value;
-    this.valueArray = new float[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new FloatColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      float[] array = new float[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getFloat(i);
-        }
-      }
-      return new FloatColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/IntConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/IntConstantFill.java
deleted file mode 100644
index bbe34abf6c..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/IntConstantFill.java
+++ /dev/null
@@ -1,62 +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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.IntColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class IntConstantFill implements IFill {
-
-  // fill value
-  private final int value;
-  // used for constructing RunLengthEncodedColumn
-  private final int[] valueArray;
-
-  public IntConstantFill(int value) {
-    this.value = value;
-    this.valueArray = new int[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new IntColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      int[] array = new int[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getInt(i);
-        }
-      }
-      return new IntColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/LongConstantFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/LongConstantFill.java
deleted file mode 100644
index 72721980da..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/constant/LongConstantFill.java
+++ /dev/null
@@ -1,62 +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.process.fill.constant;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.LongColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class LongConstantFill implements IFill {
-
-  // fill value
-  private final long value;
-  // used for constructing RunLengthEncodedColumn
-  private final long[] valueArray;
-
-  public LongConstantFill(long value) {
-    this.value = value;
-    this.valueArray = new long[] {value};
-  }
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn doesn't have any null value, or it's empty, just return itself;
-    if (!valueColumn.mayHaveNull() || size == 0) {
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      return new RunLengthEncodedColumn(new LongColumn(1, Optional.empty(), valueArray), size);
-    } else {
-      long[] array = new long[size];
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          array[i] = value;
-        } else {
-          array[i] = valueColumn.getLong(i);
-        }
-      }
-      return new LongColumn(size, Optional.empty(), array);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/DoubleLinearFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/DoubleLinearFill.java
deleted file mode 100644
index 52a228b1e4..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/DoubleLinearFill.java
+++ /dev/null
@@ -1,94 +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.process.fill.linear;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.DoubleColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.DoubleColumnBuilder;
-
-import java.util.Optional;
-
-public class DoubleLinearFill extends LinearFill {
-
-  // previous value
-  private double previousValue;
-  // next non-null value whose time is closest to the current TsBlock's endTime
-  private double nextValue;
-
-  private double nextValueInCurrentColumn;
-
-  @Override
-  void fillValue(Column column, int index, Object array) {
-    ((double[]) array)[index] = column.getDouble(index);
-  }
-
-  @Override
-  void fillValue(Object array, int index) {
-    ((double[]) array)[index] = getFilledValue();
-  }
-
-  @Override
-  Object createValueArray(int size) {
-    return new double[size];
-  }
-
-  @Override
-  Column createNullValueColumn() {
-    return DoubleColumnBuilder.NULL_VALUE_BLOCK;
-  }
-
-  @Override
-  Column createFilledValueColumn() {
-    double filledValue = getFilledValue();
-    return new DoubleColumn(1, Optional.empty(), new double[] {filledValue});
-  }
-
-  @Override
-  Column createFilledValueColumn(Object array, boolean[] isNull, boolean hasNullValue, int size) {
-    if (hasNullValue) {
-      return new DoubleColumn(size, Optional.of(isNull), (double[]) array);
-    } else {
-      return new DoubleColumn(size, Optional.empty(), (double[]) array);
-    }
-  }
-
-  @Override
-  void updatePreviousValue(Column column, int index) {
-    previousValue = column.getDouble(index);
-  }
-
-  @Override
-  void updateNextValue(Column nextValueColumn, int index) {
-    this.nextValue = nextValueColumn.getDouble(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn(Column nextValueColumn, int index) {
-    this.nextValueInCurrentColumn = nextValueColumn.getDouble(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn() {
-    this.nextValueInCurrentColumn = this.nextValue;
-  }
-
-  private double getFilledValue() {
-    return (previousValue + nextValueInCurrentColumn) / 2.0;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/FloatLinearFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/FloatLinearFill.java
deleted file mode 100644
index a32c60d61e..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/FloatLinearFill.java
+++ /dev/null
@@ -1,94 +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.process.fill.linear;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.FloatColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.FloatColumnBuilder;
-
-import java.util.Optional;
-
-public class FloatLinearFill extends LinearFill {
-
-  // previous value
-  private float previousValue;
-  // next non-null value whose time is closest to the current TsBlock's endTime
-  private float nextValue;
-
-  private float nextValueInCurrentColumn;
-
-  @Override
-  void fillValue(Column column, int index, Object array) {
-    ((float[]) array)[index] = column.getFloat(index);
-  }
-
-  @Override
-  void fillValue(Object array, int index) {
-    ((float[]) array)[index] = getFilledValue();
-  }
-
-  @Override
-  Object createValueArray(int size) {
-    return new float[size];
-  }
-
-  @Override
-  Column createNullValueColumn() {
-    return FloatColumnBuilder.NULL_VALUE_BLOCK;
-  }
-
-  @Override
-  Column createFilledValueColumn() {
-    float filledValue = getFilledValue();
-    return new FloatColumn(1, Optional.empty(), new float[] {filledValue});
-  }
-
-  @Override
-  Column createFilledValueColumn(Object array, boolean[] isNull, boolean hasNullValue, int size) {
-    if (hasNullValue) {
-      return new FloatColumn(size, Optional.of(isNull), (float[]) array);
-    } else {
-      return new FloatColumn(size, Optional.empty(), (float[]) array);
-    }
-  }
-
-  @Override
-  void updatePreviousValue(Column column, int index) {
-    previousValue = column.getFloat(index);
-  }
-
-  @Override
-  void updateNextValue(Column nextValueColumn, int index) {
-    this.nextValue = nextValueColumn.getFloat(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn(Column nextValueColumn, int index) {
-    this.nextValueInCurrentColumn = nextValueColumn.getFloat(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn() {
-    this.nextValueInCurrentColumn = this.nextValue;
-  }
-
-  private float getFilledValue() {
-    return (previousValue + nextValueInCurrentColumn) / 2.0f;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/IntLinearFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/IntLinearFill.java
deleted file mode 100644
index baf4806551..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/IntLinearFill.java
+++ /dev/null
@@ -1,94 +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.process.fill.linear;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.IntColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.IntColumnBuilder;
-
-import java.util.Optional;
-
-public class IntLinearFill extends LinearFill {
-
-  // previous value
-  private int previousValue;
-  // next non-null value whose time is closest to the current TsBlock's endTime
-  private int nextValue;
-
-  private int nextValueInCurrentColumn;
-
-  @Override
-  void fillValue(Column column, int index, Object array) {
-    ((int[]) array)[index] = column.getInt(index);
-  }
-
-  @Override
-  void fillValue(Object array, int index) {
-    ((int[]) array)[index] = getFilledValue();
-  }
-
-  @Override
-  Object createValueArray(int size) {
-    return new int[size];
-  }
-
-  @Override
-  Column createNullValueColumn() {
-    return IntColumnBuilder.NULL_VALUE_BLOCK;
-  }
-
-  @Override
-  Column createFilledValueColumn() {
-    int filledValue = getFilledValue();
-    return new IntColumn(1, Optional.empty(), new int[] {filledValue});
-  }
-
-  @Override
-  Column createFilledValueColumn(Object array, boolean[] isNull, boolean hasNullValue, int size) {
-    if (hasNullValue) {
-      return new IntColumn(size, Optional.of(isNull), (int[]) array);
-    } else {
-      return new IntColumn(size, Optional.empty(), (int[]) array);
-    }
-  }
-
-  @Override
-  void updatePreviousValue(Column column, int index) {
-    previousValue = column.getInt(index);
-  }
-
-  @Override
-  void updateNextValue(Column nextValueColumn, int index) {
-    this.nextValue = nextValueColumn.getInt(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn(Column nextValueColumn, int index) {
-    this.nextValueInCurrentColumn = nextValueColumn.getInt(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn() {
-    this.nextValueInCurrentColumn = this.nextValue;
-  }
-
-  private int getFilledValue() {
-    return (previousValue + nextValueInCurrentColumn) / 2;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/LongLinearFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/LongLinearFill.java
deleted file mode 100644
index 04dba1613a..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/linear/LongLinearFill.java
+++ /dev/null
@@ -1,94 +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.process.fill.linear;
-
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.LongColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.LongColumnBuilder;
-
-import java.util.Optional;
-
-public class LongLinearFill extends LinearFill {
-
-  // previous value
-  private long previousValue;
-  // next non-null value whose time is closest to the current TsBlock's endTime
-  private long nextValue;
-
-  private long nextValueInCurrentColumn;
-
-  @Override
-  void fillValue(Column column, int index, Object array) {
-    ((long[]) array)[index] = column.getLong(index);
-  }
-
-  @Override
-  void fillValue(Object array, int index) {
-    ((long[]) array)[index] = getFilledValue();
-  }
-
-  @Override
-  Object createValueArray(int size) {
-    return new long[size];
-  }
-
-  @Override
-  Column createNullValueColumn() {
-    return LongColumnBuilder.NULL_VALUE_BLOCK;
-  }
-
-  @Override
-  Column createFilledValueColumn() {
-    long filledValue = getFilledValue();
-    return new LongColumn(1, Optional.empty(), new long[] {filledValue});
-  }
-
-  @Override
-  Column createFilledValueColumn(Object array, boolean[] isNull, boolean hasNullValue, int size) {
-    if (hasNullValue) {
-      return new LongColumn(size, Optional.of(isNull), (long[]) array);
-    } else {
-      return new LongColumn(size, Optional.empty(), (long[]) array);
-    }
-  }
-
-  @Override
-  void updatePreviousValue(Column column, int index) {
-    previousValue = column.getLong(index);
-  }
-
-  @Override
-  void updateNextValue(Column nextValueColumn, int index) {
-    this.nextValue = nextValueColumn.getLong(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn(Column nextValueColumn, int index) {
-    this.nextValueInCurrentColumn = nextValueColumn.getLong(index);
-  }
-
-  @Override
-  void updateNextValueInCurrentColumn() {
-    this.nextValueInCurrentColumn = this.nextValue;
-  }
-
-  private long getFilledValue() {
-    return (previousValue + nextValueInCurrentColumn) / 2L;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BinaryPreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BinaryPreviousFill.java
deleted file mode 100644
index ef298e54c1..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BinaryPreviousFill.java
+++ /dev/null
@@ -1,86 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.BinaryColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.BinaryColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-import org.apache.iotdb.tsfile.utils.Binary;
-
-import java.util.Optional;
-
-public class BinaryPreviousFill implements IFill {
-
-  // previous value
-  private Binary value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getBinary(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(BinaryColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new BinaryColumn(1, Optional.empty(), new Binary[] {value}), size);
-      }
-    } else {
-      Binary[] array = new Binary[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getBinary(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new BinaryColumn(size, Optional.of(isNull), array);
-      } else {
-        return new BinaryColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BooleanPreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BooleanPreviousFill.java
deleted file mode 100644
index 74bf4466a3..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/BooleanPreviousFill.java
+++ /dev/null
@@ -1,85 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.BooleanColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.BooleanColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class BooleanPreviousFill implements IFill {
-
-  // previous value
-  private boolean value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getBoolean(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(BooleanColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new BooleanColumn(1, Optional.empty(), new boolean[] {value}), size);
-      }
-    } else {
-      boolean[] array = new boolean[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getBoolean(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new BooleanColumn(size, Optional.of(isNull), array);
-      } else {
-        return new BooleanColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/DoublePreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/DoublePreviousFill.java
deleted file mode 100644
index 044d398705..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/DoublePreviousFill.java
+++ /dev/null
@@ -1,85 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.DoubleColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.DoubleColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class DoublePreviousFill implements IFill {
-
-  // previous value
-  private double value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getDouble(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(DoubleColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new DoubleColumn(1, Optional.empty(), new double[] {value}), size);
-      }
-    } else {
-      double[] array = new double[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getDouble(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new DoubleColumn(size, Optional.of(isNull), array);
-      } else {
-        return new DoubleColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/FloatPreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/FloatPreviousFill.java
deleted file mode 100644
index 6eec0f1eb0..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/FloatPreviousFill.java
+++ /dev/null
@@ -1,85 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.FloatColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.FloatColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class FloatPreviousFill implements IFill {
-
-  // previous value
-  private float value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getFloat(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(FloatColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new FloatColumn(1, Optional.empty(), new float[] {value}), size);
-      }
-    } else {
-      float[] array = new float[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getFloat(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new FloatColumn(size, Optional.of(isNull), array);
-      } else {
-        return new FloatColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/IntPreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/IntPreviousFill.java
deleted file mode 100644
index b2864fad39..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/IntPreviousFill.java
+++ /dev/null
@@ -1,85 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.IntColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.IntColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class IntPreviousFill implements IFill {
-
-  // previous value
-  private int value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getInt(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(IntColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new IntColumn(1, Optional.empty(), new int[] {value}), size);
-      }
-    } else {
-      int[] array = new int[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getInt(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new IntColumn(size, Optional.of(isNull), array);
-      } else {
-        return new IntColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/LongPreviousFill.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/LongPreviousFill.java
deleted file mode 100644
index a90ab9b039..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/fill/previous/LongPreviousFill.java
+++ /dev/null
@@ -1,85 +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.process.fill.previous;
-
-import org.apache.iotdb.db.mpp.execution.operator.process.fill.IFill;
-import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.common.block.column.LongColumn;
-import org.apache.iotdb.tsfile.read.common.block.column.LongColumnBuilder;
-import org.apache.iotdb.tsfile.read.common.block.column.RunLengthEncodedColumn;
-
-import java.util.Optional;
-
-public class LongPreviousFill implements IFill {
-
-  // previous value
-  private long value;
-  // whether previous value is null
-  private boolean previousIsNull = true;
-
-  @Override
-  public Column fill(Column valueColumn) {
-    int size = valueColumn.getPositionCount();
-    // if this valueColumn is empty, just return itself;
-    if (size == 0) {
-      return valueColumn;
-    }
-    // if this valueColumn doesn't have any null value, record the last value, and then return
-    // itself.
-    if (!valueColumn.mayHaveNull()) {
-      previousIsNull = false;
-      // update the value using last non-null value
-      value = valueColumn.getLong(size - 1);
-      return valueColumn;
-    }
-    // if its values are all null
-    if (valueColumn instanceof RunLengthEncodedColumn) {
-      if (previousIsNull) {
-        return new RunLengthEncodedColumn(LongColumnBuilder.NULL_VALUE_BLOCK, size);
-      } else {
-        return new RunLengthEncodedColumn(
-            new LongColumn(1, Optional.empty(), new long[] {value}), size);
-      }
-    } else {
-      long[] array = new long[size];
-      boolean[] isNull = new boolean[size];
-      // have null value
-      boolean hasNullValue = false;
-      for (int i = 0; i < size; i++) {
-        if (valueColumn.isNull(i)) {
-          if (previousIsNull) {
-            isNull[i] = true;
-            hasNullValue = true;
-          } else {
-            array[i] = value;
-          }
-        } else {
-          array[i] = valueColumn.getLong(i);
-          value = array[i];
-          previousIsNull = false;
-        }
-      }
-      if (hasNullValue) {
-        return new LongColumn(size, Optional.of(isNull), array);
-      } else {
-        return new LongColumn(size, Optional.empty(), array);
-      }
-    }
-  }
-}