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