@Override
  public Column fill(Column timeColumn, Column valueColumn, long startRowIndex) {
    int size = valueColumn.getPositionCount();
    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()) {
      int lastNonNullIndex = -1;
      if (!timeColumn.mayHaveNull()) {
        lastNonNullIndex = size - 1;
      } else {
        for (int i = size - 1; i >= 0; i--) {
          if (!timeColumn.isNull(i)) {
            lastNonNullIndex = i;
            break;
          }
        }
      }
      if (lastNonNullIndex != -1) {
        previousIsNull = false;
        // update the value using last non-null value
        previousTime = timeColumn.getLong(lastNonNullIndex);
        updatePreviousValue(valueColumn, lastNonNullIndex);
      }

      return valueColumn;
    }

    // if its values are all null
    if ((valueColumn instanceof RunLengthEncodedColumn)) {
      return doWithAllNulls(startRowIndex, size, timeColumn, valueColumn);
    } else {
      Object array = createValueArray(size);
      boolean[] isNull = new boolean[size];
      // have null value
      boolean hasNullValue = false;

      for (int i = 0; i < size; i++) {
        // current value is null, we need to fill it
        if (valueColumn.isNull(i)) {
          hasNullValue =
              fill(startRowIndex, i, isNull, timeColumn, valueColumn, array) || hasNullValue;
        } else { // current is not null
          // fill value using its own value
          fillValue(valueColumn, i, array);
          if (!timeColumn.isNull(i)) {
            // update previous value
            previousTime = timeColumn.getLong(i);
            updatePreviousValue(valueColumn, i);
            previousIsNull = false;
          }
        }
      }
      return createFilledValueColumn(array, isNull, hasNullValue, size);
    }
  }
The result of Linear Fill functions at timestamp "T" is calculated by performing a linear fitting
method on two time series values, one is at the closest timestamp before T, and the other is at
the closest timestamp after T. Linear Fill function calculation only supports numeric types
including long, int, double and float.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/fill/linear/LinearFill.java