Val, thanks for your offer to help. The example is provided in my original
post. Just register the class in your cache and set the breakpoint in the
function to see if it gets called. You don't have to have any specific
cache structure, just run a pure /"select affinityKey('java.lang.String',
'key20')"/ without any from clause and I doubt you would hit the breakpoint.
However I have also found out that if I were to declare a concrete vararg
type instead of Object then it works fine. So the problem is about the
Object vararg type and not varargs in general. The following works fine:
/select worksFine('java.lang.String', 'key20')
public class MySql {
@QuerySqlFunction
public static org.apache.ignite.cache.affinity.AffinityKey<?>
worksFine(String keyClz, String... ctorArgs) throws NoSuchMethodException,
SecurityException, ClassNotFoundException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
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 new
org.apache.ignite.cache.affinity.AffinityKey(ctor.newInstance(ctorArgs));
}
} /
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/QuerySqlFunction-methods-with-variable-arguments-do-not-seem-to-work-tp6524p6569.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.