Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-3608

QuerySqlFunction methods with Object type var args do not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.5.0.final, 1.6
    • 1.9
    • cache, sql

    Description

      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:

        @QuerySqlFunction 
          public static 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:
      select t('java.lang.String', 'key20') <- Fails

      However, there is no problems with this function:

         @QuerySqlFunction 
          public static Object t1(String clz, String... ctorArgs) throws Exception { 
                  return t(clz, ctorArgs);
          }
      

      select t1('java.lang.String', 'key20') <- Works as expected

      Attachments

        Activity

          People

            Unassigned Unassigned
            ekaganovich@yahoo.com Edward Kaganovich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: