calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <>
Subject Re: type coercion
Date Tue, 16 Sep 2014 22:29:12 GMT
The method name “leastRestrictiveByCast" does make it look that way. I do not recall why
the method has that name. However, “leastRestrictive" is used in places where casts are
not involved, and coercion should not occur.

For instance, if I change those two ‘false’ values to ‘true’, Optiq’s validator

  values (1), (’a’)


  select * from emp where deptno in (1, ‘a’)

as valid whereas it should give an error.

Can you give a use case where the current behavior is wrong?


On Sep 16, 2014, at 3:14 PM, Ashutosh Chauhan <> wrote:

> SqlTypeFactoryImpl::leastRestrictive() calls leastRestrictiveByCast() which
> calls sqlTypeUtil.canCastFrom(type, resultType, false). Last boolean
> argument is about type coercion. Since, its called from SqlTypeFactoryImpl,
> I expected coercion should have been allowed here and canCastFrom() should
> have been called with true, atleast thats what comment of canCastFrom()
> method seems to suggest. Is this a bug or am I missing something here?
> Thanks,
> Ashutosh

View raw message