You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by Yuan Tian <ja...@gmail.com> on 2022/10/07 06:55:47 UTC

Treat predicate whose time series doesn't exist as false

Hi,

    Currently in IoTDB, if users write a non-exist time series in
select clause, we will simply ignore that and don't display it in
result columns instead of throwing exceptions. However, if users write
a non-exist time series in where clause, we will throw an exception
like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
It's inconsistent with the select clause, so we prepare to just treat
predicate whose time series doesn't exist as false instead of throwing
exception, same as InfluxDB.
    How do you guys think?
    The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576


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

Re:Re: Treat predicate whose time series doesn't exist as false

Posted by 李伟豪 <18...@163.com>.
Hi,
We are developping this feature now, we introduce the Null ConstantOperand to denote timeseries that do not exist in Where/Having clasuse. 
For example:
select * from root.sg.d1 where s1 > 1 (root.sg.d1.s1 is not existed) 
After analyze, the where predicate will be refactor as : NULL > 1, and the final result of this predicate will always be NULL, no rows can be selected (only true the row will be selected), this query returns empty block.
 

Additionally, we tidy up the null-related operation rules, refers to MySQL and SQL Server

1. Arithmetic:+, -, *, /, %
The resulst will be NULL if any Operand is NULL.
2.Compare: =, >, <, like, in, between...(don't include `is null`)
The resulst will be NULL if any Operand is NULL.
3.Logic: not, and, or
In the following table, `?` (Undefined) stands for NULL
If the table are not transmit, you can see https://learn.microsoft.com/zh-cn/sql/connect/ado-net/sql/handle-null-values?view=sql-server-ver16
|A|B|A ∨ B|A ∧ B|¬ A|
|T|T|T|T|F|
|T|?|T|?|F|
|T|F|T|F|F|
|?|T|T|?|?|
|?|?|?|?|?|
|?|F|?|F|?|
|F|T|T|F|T|
|F|?|?|F|T|
|F|F|F|F|T|
在 2022-10-09 09:49:58,"Jialin Qiao" <qi...@apache.org> 写道:
>+1, return empty is better than throwing an exception.
>—————————————————
>Jialin Qiao
>Apache IoTDB PMC
>
>冯 庆新 <qi...@hotmail.com> 于2022年10月8日周六 21:25写道:
>>
>> Hi,
>> I support you in this improvement.
>>
>> 获取 Outlook for iOS<https://aka.ms/o0ukef>
>> ________________________________
>> 发件人: Zhou Yifu <ef...@outlook.com>
>> 发送时间: Friday, October 7, 2022 3:48:43 PM
>> 收件人: dev@iotdb.apache.org <de...@iotdb.apache.org>
>> 主题: 回复: Treat predicate whose time series doesn't exist as false
>>
>> Yes, I agree with you. Query should not return an exception except for a syntax error.
>>
>> Thanks,
>> Yifu Zhou
>>
>> 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送
>>
>> 发件人: Yuan Tian<ma...@gmail.com>
>> 发送时间: 2022年10月7日 14:56
>> 收件人: dev<ma...@iotdb.apache.org>
>> 主题: Treat predicate whose time series doesn't exist as false
>>
>> Hi,
>>
>>     Currently in IoTDB, if users write a non-exist time series in
>> select clause, we will simply ignore that and don't display it in
>> result columns instead of throwing exceptions. However, if users write
>> a non-exist time series in where clause, we will throw an exception
>> like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
>> It's inconsistent with the select clause, so we prepare to just treat
>> predicate whose time series doesn't exist as false instead of throwing
>> exception, same as InfluxDB.
>>     How do you guys think?
>>     The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576
>>
>>
>> Best,
>> ------------------
>> Yuan Tian
>>

Re:Re: Treat predicate whose time series doesn't exist as false

Posted by 李伟豪 <18...@163.com>.
Hi,
We are developping this feature now, we introduce the Null ConstantOperand to denote timeseries that do not exist in Where/Having clasuse. 
For example:
select * from root.sg.d1 where s1 > 1 (root.sg.d1.s1 is not existed) 
After analyze, the where predicate will be refactor as : NULL > 1, and the final result of this predicate will always be NULL, no rows can be selected (only true the row will be selected), this query returns empty block.
 

Additionally, we tidy up the null-related operation rules, refers to MySQL and SQL Server

1. Arithmetic:+, -, *, /, %
The resulst will be NULL if any Operand is NULL.
2.Compare: =, >, <, like, in, between...(don't include `is null`)
The resulst will be NULL if any Operand is NULL.
3.Logic: not, and, or
In the following figure, `U` (Undefined) stands for NULL

在 2022-10-09 09:49:58,"Jialin Qiao" <qi...@apache.org> 写道:
>+1, return empty is better than throwing an exception.
>—————————————————
>Jialin Qiao
>Apache IoTDB PMC
>
>冯 庆新 <qi...@hotmail.com> 于2022年10月8日周六 21:25写道:
>>
>> Hi,
>> I support you in this improvement.
>>
>> 获取 Outlook for iOS<https://aka.ms/o0ukef>
>> ________________________________
>> 发件人: Zhou Yifu <ef...@outlook.com>
>> 发送时间: Friday, October 7, 2022 3:48:43 PM
>> 收件人: dev@iotdb.apache.org <de...@iotdb.apache.org>
>> 主题: 回复: Treat predicate whose time series doesn't exist as false
>>
>> Yes, I agree with you. Query should not return an exception except for a syntax error.
>>
>> Thanks,
>> Yifu Zhou
>>
>> 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送
>>
>> 发件人: Yuan Tian<ma...@gmail.com>
>> 发送时间: 2022年10月7日 14:56
>> 收件人: dev<ma...@iotdb.apache.org>
>> 主题: Treat predicate whose time series doesn't exist as false
>>
>> Hi,
>>
>>     Currently in IoTDB, if users write a non-exist time series in
>> select clause, we will simply ignore that and don't display it in
>> result columns instead of throwing exceptions. However, if users write
>> a non-exist time series in where clause, we will throw an exception
>> like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
>> It's inconsistent with the select clause, so we prepare to just treat
>> predicate whose time series doesn't exist as false instead of throwing
>> exception, same as InfluxDB.
>>     How do you guys think?
>>     The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576
>>
>>
>> Best,
>> ------------------
>> Yuan Tian
>>

Re: Treat predicate whose time series doesn't exist as false

Posted by Jialin Qiao <qi...@apache.org>.
+1, return empty is better than throwing an exception.
—————————————————
Jialin Qiao
Apache IoTDB PMC

冯 庆新 <qi...@hotmail.com> 于2022年10月8日周六 21:25写道:
>
> Hi,
> I support you in this improvement.
>
> 获取 Outlook for iOS<https://aka.ms/o0ukef>
> ________________________________
> 发件人: Zhou Yifu <ef...@outlook.com>
> 发送时间: Friday, October 7, 2022 3:48:43 PM
> 收件人: dev@iotdb.apache.org <de...@iotdb.apache.org>
> 主题: 回复: Treat predicate whose time series doesn't exist as false
>
> Yes, I agree with you. Query should not return an exception except for a syntax error.
>
> Thanks,
> Yifu Zhou
>
> 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送
>
> 发件人: Yuan Tian<ma...@gmail.com>
> 发送时间: 2022年10月7日 14:56
> 收件人: dev<ma...@iotdb.apache.org>
> 主题: Treat predicate whose time series doesn't exist as false
>
> Hi,
>
>     Currently in IoTDB, if users write a non-exist time series in
> select clause, we will simply ignore that and don't display it in
> result columns instead of throwing exceptions. However, if users write
> a non-exist time series in where clause, we will throw an exception
> like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
> It's inconsistent with the select clause, so we prepare to just treat
> predicate whose time series doesn't exist as false instead of throwing
> exception, same as InfluxDB.
>     How do you guys think?
>     The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576
>
>
> Best,
> ------------------
> Yuan Tian
>

Re: Treat predicate whose time series doesn't exist as false

Posted by 冯 庆新 <qi...@hotmail.com>.
Hi,
I support you in this improvement.

获取 Outlook for iOS<https://aka.ms/o0ukef>
________________________________
发件人: Zhou Yifu <ef...@outlook.com>
发送时间: Friday, October 7, 2022 3:48:43 PM
收件人: dev@iotdb.apache.org <de...@iotdb.apache.org>
主题: 回复: Treat predicate whose time series doesn't exist as false

Yes, I agree with you. Query should not return an exception except for a syntax error.

Thanks,
Yifu Zhou

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送

发件人: Yuan Tian<ma...@gmail.com>
发送时间: 2022年10月7日 14:56
收件人: dev<ma...@iotdb.apache.org>
主题: Treat predicate whose time series doesn't exist as false

Hi,

    Currently in IoTDB, if users write a non-exist time series in
select clause, we will simply ignore that and don't display it in
result columns instead of throwing exceptions. However, if users write
a non-exist time series in where clause, we will throw an exception
like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
It's inconsistent with the select clause, so we prepare to just treat
predicate whose time series doesn't exist as false instead of throwing
exception, same as InfluxDB.
    How do you guys think?
    The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576


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


回复: Treat predicate whose time series doesn't exist as false

Posted by Zhou Yifu <ef...@outlook.com>.
Yes, I agree with you. Query should not return an exception except for a syntax error.

Thanks,
Yifu Zhou

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送

发件人: Yuan Tian<ma...@gmail.com>
发送时间: 2022年10月7日 14:56
收件人: dev<ma...@iotdb.apache.org>
主题: Treat predicate whose time series doesn't exist as false

Hi,

    Currently in IoTDB, if users write a non-exist time series in
select clause, we will simply ignore that and don't display it in
result columns instead of throwing exceptions. However, if users write
a non-exist time series in where clause, we will throw an exception
like: `the path 'root.test.g_0.d1.s2' in WHERE clause does not exist`.
It's inconsistent with the select clause, so we prepare to just treat
predicate whose time series doesn't exist as false instead of throwing
exception, same as InfluxDB.
    How do you guys think?
    The JIRA is https://issues.apache.org/jira/browse/IOTDB-4576


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