Hi Apache IoTDB community,

I am working on https://github.com/apache/iotdb/issues/17798. Before
implementation, I would like to clarify the feature definition for FILL
METHOD NEXT.


Scope:

This proposal is only for the table model. Tree model behavior is unchanged.


Syntax:

FILL METHOD NEXT

FILL METHOD NEXT TIME_BOUND <interval>

FILL METHOD NEXT TIME_COLUMN <columnIndex> FILL_GROUP <columnIndex>[, ...]

FILL METHOD NEXT TIME_BOUND <interval> TIME_COLUMN <columnIndex>

FILL METHOD NEXT TIME_BOUND <interval> TIME_COLUMN <columnIndex> FILL_GROUP
<columnIndex>[, ...]


Semantics:

FILL METHOD NEXT is a look-ahead fill over the current result sequence.


When a column in the current row is null, it is filled with the nearest
non-null value that appears later in the current operator input/result
order. If no such value exists, it remains null.


NEXT copies the candidate value directly. It does not interpolate.


NEXT follows the operator input/result order. It does not independently
reorder rows by timestamp when searching for the candidate value.


Components:

- TIME_BOUND <interval>:

  The candidate next value is used only when the time difference between
the current row and the candidate row is within the specified bound.

- TIME_COLUMN <columnIndex>:

  Specifies the helper time column used for TIME_BOUND checking when
needed. Plain FILL METHOD NEXT does not require a helper time column in the
select list.

- FILL_GROUP <columnIndex>[, ...]:

  Limits the look-ahead search to rows in the same group. Values must not
be filled across group boundaries.


Supported data types:

NEXT should support the same value types as PREVIOUS:

BOOLEAN, INT32, INT64, FLOAT, DOUBLE, DATE, TIMESTAMP, TEXT, STRING, BLOB,
and OBJECT.


Examples:


1. Basic NEXT fill


SELECT time, s1 FROM table1

FILL METHOD NEXT;


If s1 is [null, null, 10, null], the filled result is [10, 10, 10, null].


2. NEXT with TIME_BOUND


SELECT time, s1 FROM table1

FILL METHOD NEXT TIME_BOUND 2ms;


A null value is filled only if the nearest later non-null value is within
2ms.


3. NEXT with FILL_GROUP


SELECT time, device, s1 FROM table1

FILL METHOD NEXT FILL_GROUP 2;


The next value is searched only within the same device group.


4. NEXT with TIME_BOUND, TIME_COLUMN, and FILL_GROUP


SELECT time, device, s1 FROM table1

FILL METHOD NEXT TIME_BOUND 2ms TIME_COLUMN 1 FILL_GROUP 2;


The next value is searched only within the same device group, and is used
only if the time difference based on column 1 is within 2ms.


Compatibility:

PREVIOUS, LINEAR, and CONSTANT semantics are unchanged.


Does this definition look reasonable?


Best,

Bryan Yang(杨易达)

Reply via email to