Hi,
not sure I get your question, the javadoc of the method [1] says :
"Returns whether two types are equal, ignoring nullability."

The two types you mentioned are not equal, hence it correctly returns
false, but the method doesn't tell you if the cast is safe or not.

>From what you ask, it seems you are thinking of "canCastFrom" or
"canAssignFrom" from the same utility class?

If not, please try to describe what you are trying to achieve by calling
this method, and maybe we can help.

In general, if you have any doubt about a method, look up the associated
tests, which generally shows how the methods is used and can clarify
assumptions.

Best regards,
Alessandro

[1]
https://github.com/apache/calcite/blob/91a8ab8c061f80115ce64fb5be62e02937a0703a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java#L1247


On Thu, 25 Jan 2024 at 13:30, P.F. ZHAN <[email protected]> wrote:

> Hi, devs.
>
> I have some confuse about the method
> SqlTypeUtil#equalSansNullability(org.apache.calcite.rel.type.RelDataType,
> org.apache.calcite.rel.type.RelDataType).
>
> For example, the RexCall is *(2, cast(5 as double)), so the first type is
> BasicSqlType( INTEGER), the second type is BasicSqlType(Double), it returns
> false, is this by design?
>
> Is this because the double type is a floating point number and swapping may
> causes inconsistent calculations?
>

Reply via email to