Hi Dipti,
   It seems to be caused by the mixed usage of data types. There is a
conflict between JavaType and SqlType. You can try to check whether
there is any problem with the mapping of SQL Server's metadata types
to Calcite's types. I recommend uniformly using Sqltype.

Yu Xu <xuzifu...@apache.org> 于2025年2月27日周四 16:00写道:
>
>
>
> On 2025/01/31 03:16:28 Dipti Kulkarni wrote:
> > Hi Team,
> >
> > We have been using calcite in our product for a while and we are on 1.36 
> > version.
> > Unfortunately, one of our queries that worked earlier have started failing 
> > and nothing changed on the calcite jars as we know of. Suddenly the 
> > comparison for String to char is throwing a validation exception and we are 
> > unable to proceed to reach the sql server database.
> >
> > "Select name from myds where LOWER(user)=’qr563h3’": >From line 1, column 
> > 45 to line 1, column 73: Cannot apply '=' to arguments of type 
> > '<JAVATYPE(CLASS JAVA.LANG.STRING)> = <CHAR(7)>'. Supported form(s): 
> > '<COMPARABLE_TYPE> = <COMPARABLE_TYPE>'
> >                 at 
> > org.apache.calcite.avatica.Helper.createException(Helper.java:56)
> >                 at 
> > org.apache.calcite.avatica.Helper.createException(Helper.java:41)
> >                 at 
> > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
> >                 at 
> > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
> >                 at 
> > oracle.essbase.ds.ResultArrayType.executeQuery(ResultArrayType.java:58)
> >                 ... 21 more
> > Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, 
> > column 45 to line 1, column 73: Cannot apply '=' to arguments of type 
> > '<JAVATYPE(CLASS JAVA.LANG.STRING)> = <CHAR(7)>'. Supported form(s): 
> > '<COMPARABLE_TYPE> = <COMPARABLE_TYPE>'
> >                 at 
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> >                 at 
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> >                 at 
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >                 at 
> > java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> >                 at 
> > org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
> >                 at 
> > org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:948)
> >                 at 
> > org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:933)
> >                 at 
> > org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5517)
> >                 at 
> > org.apache.calcite.sql.SqlCallBinding.newValidationSignatureError(SqlCallBinding.java:399)
> >                 at 
> > org.apache.calcite.sql.type.ComparableOperandTypeChecker.checkOperandTypes(ComparableOperandTypeChecker.java:75)
> >                 at 
> > org.apache.calcite.sql.SqlOperator.checkOperandTypes(SqlOperator.java:761)
> >                 at 
> > org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:498)
> >                 at 
> > org.apache.calcite.sql.SqlOperator.deriveType(SqlOperator.java:607)
> >
> > Strangely, the same query works on some of the machines and is impacting 
> > few other. Could your expertise help us to dig into the issue on what 
> > parameters can affect this comparison to fail on certain machines? This is 
> > impacting our daily chores due to an outage, and we are not able to get to 
> > a reason about this failure.
> >
> > Regards,
> > Dipti
> >
>
> Could you provide more details about it such as a test.

Reply via email to