[
https://issues.apache.org/jira/browse/CALCITE-3081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16845447#comment-16845447
]
Feng Zhu commented on CALCITE-3081:
-----------------------------------
Thank for your feedback, Danny. Yes,the strong type validation results to the
exception. Yesterday, I made a fast overview on implicit type coercion in
Calcite and also found your design doc. Good work! Maybe we can do more things
to support this feature in Calcite. In our production environment, problems
related with implicit type coercision usually lead to different results. It
trouble us lot, especially for workloads migrations from one framework to
another one (e.g., Oracle to Hive, Hive to Spark SQL). BTW, from my point of
view, since no common standard for implicite type coercision (please correct me
if I made mistake), could it be implemented as dialect-specific or
database-specific? Certainly, it requires a lot of work.
As for this issue, the point we focus is the strange logic: "a query converted
back cannot be executed in Calcite itself". To some extent, it is not a
problem, should we close it?
> Literal NULL should be generated in SqlDialect
> ----------------------------------------------
>
> Key: CALCITE-3081
> URL: https://issues.apache.org/jira/browse/CALCITE-3081
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.19.0
> Reporter: Feng Zhu
> Priority: Minor
>
> In Calcite, this simple query will throw exception during validation, even it
> is ok in many databases.
> {code:java}
> Query:
> final String query = "select NULL as col "
> + "from \"foodmart\".\"product\"";
> Exception
> org.apache.calcite.tools.ValidationException:
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to
> line 1, column 11: Illegal use of 'NULL'
> {code}
> The right way to use 'NULL' in Calcite is:
> {code:java}
> final String query = "select cast(NULL as integer) as col "
> + "from \"foodmart\".\"product\"";
> {code}
> However, the converted query by *RelToSqlConverter* is illegal in Calcite.
> {code:java}
> SELECT NULL AS \"COL\"
> FROM \"foodmart\".\"product\"
> {code}
> The issue is trivial, but it is against to general sense. Maybe we can
> generate NULL literal in SqlDialect?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)