Trying to unify the behavior of different engines is always a painful task.
For example, if there is a function named `abc`, engine1 and engine2
implement it both, but they require different parameters and result in
different output, I think we must create two instances in
SqlLibraryOperators with different annotations.
Like
```
@LibraryOperator(libraries = {ENGINE1})
ABC_ENGINE1 = ...

@LibraryOperator(libraries = {ENGINE2})
ABC_ENGINE2 = ...
```

I know it is not an elegant way to solve your problem, but it works and
won't go wrong when calcite validates sql and reduces constant expression
for different engines.

Hongyu

On Thu, Mar 14, 2024 at 6:42 PM Cancai Cai <can...@apache.org> wrote:

> I've asked a lot of questions recently, and I hope I won't cause too much
> trouble to the community.
>
> On 2024/03/14 10:32:09 Cancai Cai wrote:
> > Hello, everyone in the calcite community.
> >
> > Recently, I have been adapting the behavior of functions in different
> > dialects to the calcite community. At first, I used the method in
> > CALCITE-5831 <https://issues.apache.org/jira/browse/CALCITE-5831>[1],
> but
> > later I discovered that this The method is not very suitable. A function
> > may have multiple behaviors in different dialects (for example, the
> > behaviors of the log function in mysql, pg, and bigquery are somewhat
> > different). We may need to add some specific methods and
> > SqlLibraryOperators to these behaviors respectively. name.
> >
> > In CALCITE-6325 <https://issues.apache.org/jira/browse/CALCITE-6325>[2],
> > tanclary proposed that @LibraryAnnotations can be used to optimize (I
> hope
> > I didn’t understand).  Julian also said before that it can be implemented
> > in the form of flag bits (but I don’t know how to use the database The
> type
> > flag is passed into Sqlfunctions)
> >
> > I would like to ask everyone what you think?
> >
> > Seriously, adaptation functions are not fun, but I want to help the
> > community improve this problem.
> >
> > Best wishes,
> > Cancai Cai
> >
> > [1] :https://issues.apache.org/jira/browse/CALCITE-5831
> > [2]: https://issues.apache.org/jira/browse/CALCITE-6325
> >
>

Reply via email to