{"action":"created","issue":{"url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/17","repository_url":"https://api.github.com/repos/jpmml/jpmml-evaluator","labels_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/17/comments","events_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/17/events","html_url":"https://github.com/jpmml/jpmml-evaluator/issues/17","id":138288216,"number":17,"title":"FunctionUtil.evaluate order","user":{"login":"a-mueller","id":505026,"avatar_url":"https://avatars.githubusercontent.com/u/505026?v=3","gravatar_id":"","url":"https://api.github.com/users/a-mueller","html_url":"https://github.com/a-mueller","followers_url":"https://api.github.com/users/a-mueller/followers","following_url":"https://api.github.com/users/a-mueller/following{/other_user}","gists_url":"https://api.github.com/users/a-mueller/gists{/gist_id}","starred_url":"https://api.github.com/users/a-mueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-mueller/subscriptions","organizations_url":"https://api.github.com/users/a-mueller/orgs","repos_url":"https://api.github.com/users/a-mueller/repos","events_url":"https://api.github.com/users/a-mueller/events{/privacy}","received_events_url":"https://api.github.com/users/a-mueller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-03T20:26:29Z","updated_at":"2016-03-03T21:13:56Z","closed_at":null,"body":"we have an issue in production where we have a DefineFunction in the pmml\r\n\r\nLooking at the FunctionUtil.evaluate it will try to do some reflection stuff to find a user defined one before trying to use the one from the pmml. The problem is that reflection is a bit too slow for us in production. It would be great to either have some way to supply our own FunctionRegistry or to change the order in which the functions are resolved in FunctionUtil.\r\n\r\n\r\n![screenshot from 2016-03-03 20-24-23](https://cloud.githubusercontent.com/assets/505026/13508217/f70cf34e-e17d-11e5-91f4-a17a14ae344a.png)"},"comment":{"url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/comments/191966651","html_url":"https://github.com/jpmml/jpmml-evaluator/issues/17#issuecomment-191966651","issue_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/17","id":191966651,"user":{"login":"a-mueller","id":505026,"avatar_url":"https://avatars.githubusercontent.com/u/505026?v=3","gravatar_id":"","url":"https://api.github.com/users/a-mueller","html_url":"https://github.com/a-mueller","followers_url":"https://api.github.com/users/a-mueller/followers","following_url":"https://api.github.com/users/a-mueller/following{/other_user}","gists_url":"https://api.github.com/users/a-mueller/gists{/gist_id}","starred_url":"https://api.github.com/users/a-mueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-mueller/subscriptions","organizations_url":"https://api.github.com/users/a-mueller/orgs","repos_url":"https://api.github.com/users/a-mueller/repos","events_url":"https://api.github.com/users/a-mueller/events{/privacy}","received_events_url":"https://api.github.com/users/a-mueller/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T21:13:56Z","updated_at":"2016-03-03T21:13:56Z","body":"Thanks for the fast reply. I guess this makes sense if the functions are\nrelatively static. Will have to check with data science tomorrow if that is\nan option for us.\n\nWould be great though to have an option like with the optimizer visitors to\nprioritise DefineFunctions over reflection.\n\nThanks for your great work.\nOn 3 Mar 2016 9:02 p.m., \"Villu Ruusmann\" <notifications@github.com> wrote:\n\n> The method FunctionUtil#evaluate(...) performs the resolution of a\n> function in the following order:\n> 1. PMML built-in function.\n> 2. Java UDF.\n> 3. PMML UDF as defined by some DefineFunction element.\n>\n> You cannot override override PMML built-in functions (for sanity and\n> security reasons). But you can override DefineFunction elements if you\n> register a Java UDF with the same name during the startup of your\n> application.\n>\n> For example, every SAS EM generated PMML document that deals with string\n> variables includes a SAS-EM-String-Normalize PMML UDF. The evaluation of\n> PMML UDFs is slow, becaue it will be necessary to isolate their execution\n> into a separate scope. However, you can override the PMML UDF by\n> registering an instance of org.jpmml.sas.functions.StringNormalize like\n> this:\n>\n> import org.jpmml.sas.functions.StringNormalize;\n>\n> FunctionRegistry.putFunction(new StringNormalize());\n>\n> Please note that you will be registering a singleton instance of your Java\n> UDF. So, it is your responsibility to make sure that its implementation of\n> Function#evaluate(List<FieldValue>) is thread safe.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/jpmml/jpmml-evaluator/issues/17#issuecomment-191961283>\n> .\n>\n"}}