You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by 廖兰宇 <18...@smail.nju.edu.cn> on 2022/07/18 06:43:28 UTC

Keep null value at timestamps given by filter

Hi everybody,

In 0.13/0.12, when you execute query sql "select a from root.sg where b &gt;= 3 "  with the following dataset:
+-------------------------------------+---------+---------+
|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time|root.sg.a|root.sg.b|
+-------------------------------------+---------+---------+
|1970-01-01T08:00:00.001+08:00|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1|&nbsp; &nbsp; &nbsp; &nbsp;null|
|1970-01-01T08:00:00.002+08:00|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2|&nbsp; &nbsp; &nbsp; &nbsp;null|
|1970-01-01T08:00:00.003+08:00|&nbsp; &nbsp; &nbsp; &nbsp; null|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3|
|1970-01-01T08:00:00.004+08:00|&nbsp; &nbsp; &nbsp; &nbsp; null|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4|
+-------------------------------------+----------+--------+
The expected result set would be empty because the values of root.sg.a are null at timestamp 3 and 4(b &gt;= 3).
+----+----------------+
|Time|root.test.test.a|
+----+----------------+
+----+----------------+
Empty set.
We suggest keeping the null value of the columns at the timestamp given by filter. You can use "select a from root.sg where b &gt;= 3 and a is not null" if you do not want to keep the null value. 
+-------------------------------------+---------+
|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time|root.sg.a|
+-------------------------------------+---------+
|1970-01-01T08:00:00.003+08:00|&nbsp; &nbsp; &nbsp; &nbsp;null|
|1970-01-01T08:00:00.004+08:00|&nbsp; &nbsp; &nbsp; &nbsp;null|
+-------------------------------------+---------+
Any comments would be much appreciated.

Best,

------------------------------------

Lanyu Liao

School of Software, Tsinghua University

廖兰宇

清华大学 软件学院

Re: Keep null value at timestamps given by filter

Posted by Yuan Tian <ja...@gmail.com>.
I think keeping the null value will be better, because it's consistent
with relational database.


Best,
--------------
Yuan Tian

On Mon, Jul 18, 2022 at 2:43 PM 廖兰宇 <18...@smail.nju.edu.cn> wrote:
>
> Hi everybody,
>
> In 0.13/0.12, when you execute query sql "select a from root.sg where b &gt;= 3 "  with the following dataset:
> +-------------------------------------+---------+---------+
> |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time|root.sg.a|root.sg.b|
> +-------------------------------------+---------+---------+
> |1970-01-01T08:00:00.001+08:00|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1|&nbsp; &nbsp; &nbsp; &nbsp;null|
> |1970-01-01T08:00:00.002+08:00|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2|&nbsp; &nbsp; &nbsp; &nbsp;null|
> |1970-01-01T08:00:00.003+08:00|&nbsp; &nbsp; &nbsp; &nbsp; null|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3|
> |1970-01-01T08:00:00.004+08:00|&nbsp; &nbsp; &nbsp; &nbsp; null|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4|
> +-------------------------------------+----------+--------+
> The expected result set would be empty because the values of root.sg.a are null at timestamp 3 and 4(b &gt;= 3).
> +----+----------------+
> |Time|root.test.test.a|
> +----+----------------+
> +----+----------------+
> Empty set.
> We suggest keeping the null value of the columns at the timestamp given by filter. You can use "select a from root.sg where b &gt;= 3 and a is not null" if you do not want to keep the null value.
> +-------------------------------------+---------+
> |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time|root.sg.a|
> +-------------------------------------+---------+
> |1970-01-01T08:00:00.003+08:00|&nbsp; &nbsp; &nbsp; &nbsp;null|
> |1970-01-01T08:00:00.004+08:00|&nbsp; &nbsp; &nbsp; &nbsp;null|
> +-------------------------------------+---------+
> Any comments would be much appreciated.
>
> Best,
>
> ------------------------------------
>
> Lanyu Liao
>
> School of Software, Tsinghua University
>
> 廖兰宇
>
> 清华大学 软件学院