[
https://issues.apache.org/jira/browse/CALCITE-6409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17845944#comment-17845944
]
Caican Cai edited comment on CALCITE-6409 at 5/13/24 4:01 PM:
--------------------------------------------------------------
The Boolean values and character types in the nvl and nvl2 functions in spark
are not comparable.
For example:
{code:java}
scala> val df = spark.sql("select nvl( true, 'a')")
org.apache.spark.sql.AnalysisException: [DATATYPE_MISMATCH.DATA_DIFF_TYPES]
Cannot resolve "coalesce(true, a)" due to data type mismatch: Input to
`coalesce` should all be the same type, but it's ("BOOLEAN" or "STRING").; line
1 pos 7;
'Project [unresolvedalias(nvl(true, a), None)]
+- OneRowRelation
{code}
I am building an oracle engine for testing. I feel that oracle's nvl and nvl2
functions also have the same problem.
So I am struggling with whether I should adapt to this behavior or whether
there is a unified standard.
was (Author: JIRAUSER302115):
[~julianhyde] Hello, The Boolean values and character types in the nvl and nvl2
functions in spark are not comparable.
For example:
{code:java}
scala> val df = spark.sql("select nvl( true, 'a')")
org.apache.spark.sql.AnalysisException: [DATATYPE_MISMATCH.DATA_DIFF_TYPES]
Cannot resolve "coalesce(true, a)" due to data type mismatch: Input to
`coalesce` should all be the same type, but it's ("BOOLEAN" or "STRING").; line
1 pos 7;
'Project [unresolvedalias(nvl(true, a), None)]
+- OneRowRelation
{code}
I am building an oracle engine for testing. I feel that oracle's nvl and nvl2
functions also have the same problem.
So I am struggling with whether I should adapt to this behavior or whether
there is a unified standard.
> Char types and Boolean types are comparable
> -------------------------------------------
>
> Key: CALCITE-6409
> URL: https://issues.apache.org/jira/browse/CALCITE-6409
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.37.0
> Reporter: Caican Cai
> Priority: Critical
> Fix For: 1.38.0
>
>
> In the SameOperandTypeChecker method, the char type and the boolean type are
> comparable because of the call to the isComparable method.
> Comparability of char types and boolean types returns true in the
> isComparable method.
> However, char types and Boolean types in Spark are incomparable. Does Calcite
> have fixed standards here?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)