ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward Kaganovich (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-3608) QuerySqlFunction methods with Object type var args do not work
Date Fri, 29 Jul 2016 16:36:20 GMT
Edward Kaganovich created IGNITE-3608:

             Summary: QuerySqlFunction methods with Object type var args do not work
                 Key: IGNITE-3608
                 URL: https://issues.apache.org/jira/browse/IGNITE-3608
             Project: Ignite
          Issue Type: Bug
          Components: cache, SQL
    Affects Versions: 1.6, 1.5.0.final
            Reporter: Edward Kaganovich

We often use interactive sql consoles to query caches.  Several field values as well as _key
in caches are stored as objects.  To support queries by these fields we have registered a
generic UDF that should let us instantiate certain types:

{code}   @QuerySqlFunction Object t(String clz, Object... ctorArgs) throws    Exception {
            Class<?> c = Class.forName(keyClz); 
            Class<?>[] argTypes = new Class[ctorArgs.length]; 
            for (int i=0; i < ctorArgs.length; i++) { 
                    argTypes[i] = ctorArgs[i].getClass(); 
            Constructor<?> ctor = c.getConstructor(argTypes); 
            return ctor.newInstance(ctorArgs); 
Unfortunately Ignite fails to find and execute this function for the following SQL:
{color:blue}select t('java.lang.String', 'key20')){color}{color:red} <- Fails{color}

However, there is no problems with this function:
{code}   @QuerySqlFunction 
    public static Object t1(String clz, String... ctorArgs) throws Exception { 
            return t(clz, ctorArgs);
{color:blue}select t1('java.lang.String', 'key20')){color}{color:green} <- Works as expected{color}

This message was sent by Atlassian JIRA

View raw message