[ 
https://issues.apache.org/jira/browse/CALCITE-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15107391#comment-15107391
 ] 

Julian Hyde commented on CALCITE-604:
-------------------------------------

While upgrading, if you get a stack like this:

{noformat}
java.lang.ExceptionInInitializerError
        at 
org.apache.calcite.rel.metadata.DefaultRelMetadataProvider.<init>(DefaultRelMetadataProvider.java:36)
        at ... 
Caused by: java.lang.ClassCastException: 
org.apache.calcite.rel.metadata.RelMdSomething cannot be cast to 
org.apache.calcite.rel.metadata.MetadataHandler
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider.reflectiveSource(ReflectiveRelMetadataProvider.java:119)
        at 
org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider.reflectiveSource(ReflectiveRelMetadataProvider.java:107)
        at 
org.apache.calcite.rel.metadata.RelMdPopulationSize.<clinit>(RelMdPopulationSize.java:41)
        ... 33 more
{noformat}

you need to add {{implements MetadataHandler<BuiltinMetadata.Something>}} to 
your provider (say {{RelMdPopulationSize}} needs to implement 
{{MetadataHandler<BuiltinMetadata.PopulationSize>}}.

> Invoke metadata providers via MethodHandle rather than reflection
> -----------------------------------------------------------------
>
>                 Key: CALCITE-604
>                 URL: https://issues.apache.org/jira/browse/CALCITE-604
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> JDK 1.7 introduced 
> http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandle.html, 
> a more efficient way to invoke methods. Access control etc. is done when the 
> handle is created, not each invocation.
> Currently calls to metadata providers are dispatched via reflection 
> (Method.invoke, see ReflectiveRelMetadataProvider, ChainedRelMetadataProvider 
> and CachingInvocationHandler), and I suspect that planning a complex query 
> (especially with tracing enabled) makes millions of calls. Moving to 
> MethodHandle would improve performance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to