When I was working CALCITE-6224 <https://issues.apache.org/jira/browse/CALCITE-6224>, I encountered some problems and I always had some doubts in my heart. I thought about it for a long time, maybe I think I already understand the doubts in my heart.
As @mihaibudiu said, Java grammar has its own type rules, and SQL has its own type rules. What calcite currently does is to use Java syntax to adapt to the SQL rules of each database to complete execution optimization. In some extreme scenarios, the SQL rules of various databases are inconsistent. Calcite needs to be sure to adapt to these extreme situations. But, I mean, if one day, for example, mysql returns the result of log10(0) as an error instead of null, then does calcite need to adapt to the new version of mysql? If it adapts to the new version of mysql, does calcite still need to adapt to the old version of mysql? It seems to me that this may be a paradox. Because in my opinion, it is very difficult to 100% adapt to the SQL dialect of all databases, because different dialects of each database need to be considered, and there may even be differences between versions of different versions of databases. Can anyone explain it to me? I would be very grateful.