Re: About Negative testing for adapting to different databases

2024-02-08 Thread Cancai Cai
Hi,
Thank your for yout reply

Best wishes,
Cancai Cai

Julian Hyde  于2024年2月9日周五 05:17写道:

> Functions have slightly different behaviors on different databases.
> Solving the problem starts with logging a jira case, and having a
> discussion about the specification.
>
> Rather than say (for example) ’SOUNDEX returns the wrong result’, it’s
> helpful to say ’SOUNDEX result for empty string is inconsistent with
> MySQL’. Then we can discover that SOUNDEX has different behaviors on MySQL
> and Postgres, decide whether we want to support both behaviors, and if so,
> decide how we will achieve that behavior.
>
> As I have said many times: log a jira first, and only then get to work on
> a PR.
>
> Julian
>
>
> > On Feb 6, 2024, at 8:38 AM, Mihai Budiu  wrote:
> >
> > These are two different functions with the same name.
> > You need two different implementations.
> > There are other similar functions in Calcite, e.g., SOUNDEX.
> >
> https://calcite.apache.org/docs/reference.html#dialect-specific-operators
> >
> > Mihai
> > 
> > From: Cancai Cai 
> > Sent: Tuesday, February 6, 2024 8:26 AM
> > To: dev@calcite.apache.org 
> > Subject: About Negative testing for adapting to different databases
> >
> > Hello Calcite Community,
> > I'm currently completing CALCITE-6224
> > .
> > During the completion process, we found that the return result of log2(0)
> > in calcite is different from that in mysql and spark. The return result
> of
> > log2(0) in calcite is -Infinity. But mysql and spark return NULL. We are
> > considering whether we need to adapt the return results of log2(0) in
> mysql
> > and spark. But a new problem comes out, if I adapt log2(0). Then do I
> also
> > need to consider the negative test of the two functions log10 and log in
> > other databases?
> > I believe this happens to me not only in the log function, I observed the
> > same situation in CALCITE-6241
> > .
> > Now my doubt is whether we need to adapt the negative test of each
> function
> > in each database (because there are examples of negative test results
> > caused by different databases and different versions) .
> > I think we can add a negative test in calcite to tell users and
> developers
> > how calcite handles the negatvie test of this kind of function, but I am
> > not sure whether it needs to be adapted.
> >
> > Best wishes,
> > Cancai Cai
>
>


Re: About Negative testing for adapting to different databases

2024-02-08 Thread Julian Hyde
Functions have slightly different behaviors on different databases. Solving the 
problem starts with logging a jira case, and having a discussion about the 
specification.

Rather than say (for example) ’SOUNDEX returns the wrong result’, it’s helpful 
to say ’SOUNDEX result for empty string is inconsistent with MySQL’. Then we 
can discover that SOUNDEX has different behaviors on MySQL and Postgres, decide 
whether we want to support both behaviors, and if so, decide how we will 
achieve that behavior.

As I have said many times: log a jira first, and only then get to work on a PR.

Julian


> On Feb 6, 2024, at 8:38 AM, Mihai Budiu  wrote:
> 
> These are two different functions with the same name.
> You need two different implementations.
> There are other similar functions in Calcite, e.g., SOUNDEX.
> https://calcite.apache.org/docs/reference.html#dialect-specific-operators
> 
> Mihai
> 
> From: Cancai Cai 
> Sent: Tuesday, February 6, 2024 8:26 AM
> To: dev@calcite.apache.org 
> Subject: About Negative testing for adapting to different databases
> 
> Hello Calcite Community,
> I'm currently completing CALCITE-6224
> .
> During the completion process, we found that the return result of log2(0)
> in calcite is different from that in mysql and spark. The return result of
> log2(0) in calcite is -Infinity. But mysql and spark return NULL. We are
> considering whether we need to adapt the return results of log2(0) in mysql
> and spark. But a new problem comes out, if I adapt log2(0). Then do I also
> need to consider the negative test of the two functions log10 and log in
> other databases?
> I believe this happens to me not only in the log function, I observed the
> same situation in CALCITE-6241
> .
> Now my doubt is whether we need to adapt the negative test of each function
> in each database (because there are examples of negative test results
> caused by different databases and different versions) .
> I think we can add a negative test in calcite to tell users and developers
> how calcite handles the negatvie test of this kind of function, but I am
> not sure whether it needs to be adapted.
> 
> Best wishes,
> Cancai Cai



Re: About Negative testing for adapting to different databases

2024-02-06 Thread Mihai Budiu
These are two different functions with the same name.
You need two different implementations.
There are other similar functions in Calcite, e.g., SOUNDEX.
https://calcite.apache.org/docs/reference.html#dialect-specific-operators

Mihai

From: Cancai Cai 
Sent: Tuesday, February 6, 2024 8:26 AM
To: dev@calcite.apache.org 
Subject: About Negative testing for adapting to different databases

Hello Calcite Community,
I'm currently completing CALCITE-6224
.
During the completion process, we found that the return result of log2(0)
in calcite is different from that in mysql and spark. The return result of
log2(0) in calcite is -Infinity. But mysql and spark return NULL. We are
considering whether we need to adapt the return results of log2(0) in mysql
and spark. But a new problem comes out, if I adapt log2(0). Then do I also
need to consider the negative test of the two functions log10 and log in
other databases?
I believe this happens to me not only in the log function, I observed the
same situation in CALCITE-6241
.
Now my doubt is whether we need to adapt the negative test of each function
in each database (because there are examples of negative test results
caused by different databases and different versions) .
I think we can add a negative test in calcite to tell users and developers
how calcite handles the negatvie test of this kind of function, but I am
not sure whether it needs to be adapted.

Best wishes,
Cancai Cai