You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Serhii Harnyk <se...@gmail.com> on 2016/12/06 16:18:10 UTC

PR-335 for CALCITE-1531

Hello,

I have created pull request to CALCITE-1531
<https://issues.apache.org/jira/browse/CALCITE-1531>:
https://github.com/apache/calcite/pull/335.
NULL in boolean operators in Calcite corresponds to Boolean type UNKNOWN,
so when NULL is used in this operators, we shouldn't throw exception and
continue query execution.

Could anyone please review it?

Kind regards,
Serhii Harnyk

Re: PR-335 for CALCITE-1531

Posted by Julian Hyde <jh...@apache.org>.
I've replied on the JIRA case,
https://issues.apache.org/jira/browse/CALCITE-1531. Can we move
discussion there?

Julian


On Tue, Dec 6, 2016 at 10:43 AM, Serhii Harnyk <se...@gmail.com> wrote:
> Julian,
>
> I found some notes from SQL Standard  - ISO/IEC 9075:2011 4.5.1:
>
> "This specification does not make a distinction between the null value of
> the boolean data type and the truth value Unknown that is the result of an
> SQL <predicate>, <search condition>, or <boolean value expression>; they
> may be used interchangeably to mean exactly the same thing."
>
> When Postgres executes this query:
> SELECT (CASE WHEN true or not null then 1 else 0 end) from (VALUES(1)) foo;
> it returns correct result.
>
> So do I use old specification?  And what SQL standard are you mentioned?
>
> Kind regards,
> Serhii Harnyk
>
> 2016-12-06 17:39 GMT+00:00 Julian Hyde <jh...@apache.org>:
>
>> We (and the SQL standard) don't allow raw NULLs. I'm not convinced
>> that BOOLEAN should be treated differently from other types. The only
>> difference between BOOLEAN and other types is that BOOLEAN allows
>> UNKNOWN as a synonym for NULL; none of your examples use UNKNOWN.
>>
>> On Tue, Dec 6, 2016 at 8:18 AM, Serhii Harnyk <se...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > I have created pull request to CALCITE-1531
>> > <https://issues.apache.org/jira/browse/CALCITE-1531>:
>> > https://github.com/apache/calcite/pull/335.
>> > NULL in boolean operators in Calcite corresponds to Boolean type UNKNOWN,
>> > so when NULL is used in this operators, we shouldn't throw exception and
>> > continue query execution.
>> >
>> > Could anyone please review it?
>> >
>> > Kind regards,
>> > Serhii Harnyk
>>

Re: PR-335 for CALCITE-1531

Posted by Serhii Harnyk <se...@gmail.com>.
Julian,

I found some notes from SQL Standard  - ISO/IEC 9075:2011 4.5.1:

"This specification does not make a distinction between the null value of
the boolean data type and the truth value Unknown that is the result of an
SQL <predicate>, <search condition>, or <boolean value expression>; they
may be used interchangeably to mean exactly the same thing."

When Postgres executes this query:
SELECT (CASE WHEN true or not null then 1 else 0 end) from (VALUES(1)) foo;
it returns correct result.

So do I use old specification?  And what SQL standard are you mentioned?

Kind regards,
Serhii Harnyk

2016-12-06 17:39 GMT+00:00 Julian Hyde <jh...@apache.org>:

> We (and the SQL standard) don't allow raw NULLs. I'm not convinced
> that BOOLEAN should be treated differently from other types. The only
> difference between BOOLEAN and other types is that BOOLEAN allows
> UNKNOWN as a synonym for NULL; none of your examples use UNKNOWN.
>
> On Tue, Dec 6, 2016 at 8:18 AM, Serhii Harnyk <se...@gmail.com>
> wrote:
> > Hello,
> >
> > I have created pull request to CALCITE-1531
> > <https://issues.apache.org/jira/browse/CALCITE-1531>:
> > https://github.com/apache/calcite/pull/335.
> > NULL in boolean operators in Calcite corresponds to Boolean type UNKNOWN,
> > so when NULL is used in this operators, we shouldn't throw exception and
> > continue query execution.
> >
> > Could anyone please review it?
> >
> > Kind regards,
> > Serhii Harnyk
>

Re: PR-335 for CALCITE-1531

Posted by Julian Hyde <jh...@apache.org>.
We (and the SQL standard) don't allow raw NULLs. I'm not convinced
that BOOLEAN should be treated differently from other types. The only
difference between BOOLEAN and other types is that BOOLEAN allows
UNKNOWN as a synonym for NULL; none of your examples use UNKNOWN.

On Tue, Dec 6, 2016 at 8:18 AM, Serhii Harnyk <se...@gmail.com> wrote:
> Hello,
>
> I have created pull request to CALCITE-1531
> <https://issues.apache.org/jira/browse/CALCITE-1531>:
> https://github.com/apache/calcite/pull/335.
> NULL in boolean operators in Calcite corresponds to Boolean type UNKNOWN,
> so when NULL is used in this operators, we shouldn't throw exception and
> continue query execution.
>
> Could anyone please review it?
>
> Kind regards,
> Serhii Harnyk