Re: ClassCastException: FamilyOperandTypeChecker cannot be cast to SqlOperandMetadata

2021-08-03 Thread Julian Hyde
SqlOperandMetadata only needs to be implemented by user-defined functions. 
(User-defined functions have fixed number of parameters, and the parameters 
have names; built-in functions may have a variable number of arguments, but 
they do not have names.)

So, maybe the cause is a function that isn’t sure whether it’s a UDF or a 
built-in.

My money is on user error rather than Calcite bug.

> On Jul 28, 2021, at 12:19 AM, Yanjing Wang  wrote:
> 
> It may be a bug caused by CALCITE-4427
> , I
> think lookupSubjectRoutines behavior is a bit strange. when found routines
> are less than two, It returns directly whatever the routine SqlKind is.
> otherwise filtered by SqlKind. This behavior may cause empty routine
> results when all candidates are filtered out. @Julian, could you help the
> exception to be fixed?
> 
> wrstrs  于2021年7月27日周二 下午3:33写道:
> 
>> Hi, all
>> 
>> how to solve this problem?
>> 
>> 
>> 
>> 
>> my code:
>> String sql = "select UNIX_TIMESTAMP(concat(substr('2021-07-27
>> 12:12:12',0,11),'09:00:00'))";
>> 
>> SqlOperatorTable opTab =
>>   
>> SqlLibraryOperatorTableFactory.INSTANCE.getOperatorTable(EnumSet.of(
>>SqlLibrary.HIVE,
>> SqlLibrary.SPARK, SqlLibrary.BIG_QUERY, SqlLibrary.ORACLE,
>> SqlLibrary.MYSQL, SqlLibrary.STANDARD));
>> SchemaPlus rootSchema = Frameworks.createRootSchema(true);
>> 
>> FrameworkConfig frameworkConfig = Frameworks.newConfigBuilder()
>>.defaultSchema(rootSchema)
>>.operatorTable(opTab)
>>.build();
>> 
>> Planner planner = Frameworks.getPlanner(frameworkConfig);
>> SqlNode sqlNode = planner.parse(sql);
>> SqlNode validateSqlNode = planner.validate(sqlNode);
>> 
>> 
>> 
>> throw exception:
>> 
>> Exception in thread "main" org.apache.calcite.tools.ValidationException:
>> java.lang.ClassCastException:
>> org.apache.calcite.sql.type.FamilyOperandTypeChecker cannot be cast to
>> org.apache.calcite.sql.type.SqlOperandMetadata
>> 
>>at
>> org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:228)
>> 
>> Caused by: java.lang.ClassCastException:
>> org.apache.calcite.sql.type.FamilyOperandTypeChecker cannot be cast to
>> org.apache.calcite.sql.type.SqlOperandMetadata
>> 
>>at
>> org.apache.calcite.sql.validate.implicit.TypeCoercionImpl.userDefinedFunctionCoercion(TypeCoercionImpl.java:589)
>> 
>>at
>> org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:303)
>> 
>>at
>> org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)



[jira] [Created] (CALCITE-4715) Create CITATION.cff for BibTex, APA citation UI in GitHub

2021-08-03 Thread Vladimir Sitnikov (Jira)
Vladimir Sitnikov created CALCITE-4715:
--

 Summary: Create CITATION.cff for BibTex, APA citation UI in GitHub
 Key: CALCITE-4715
 URL: https://issues.apache.org/jira/browse/CALCITE-4715
 Project: Calcite
  Issue Type: Improvement
Reporter: Vladimir Sitnikov


See https://twitter.com/natfriedman/status/1420122675813441540



--
This message was sent by Atlassian Jira
(v8.3.4#803005)