stevedlawrence commented on a change in pull request #273: WIP: Add User
Defined Functions Capability
URL: https://github.com/apache/incubator-daffodil/pull/273#discussion_r331474556
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
##########
@@ -1870,6 +1871,47 @@ case class FunctionCallExpression(functionQNameString:
String, expressions: List
case (RefQName(_, "unsignedByte", XSD), args) =>
XSConverterExpr(functionQNameString, functionQName, args,
NodeInfo.UnsignedByte)
+ case (RefQName(Some(_), _, _), args) => {
+ val namespace = functionQName.namespace.toString()
+ val fName = functionQName.local
+
+ lazy val udfservice = {
+ val a = UDFService
+ a.warnings.map { w => SDW(WarnID.UserDefinedFunction, w) }
+ val allErrors = a.errors.mkString("\n\n")
+ SDE(s"Function unknown: fname[${fName}]
fnamespace[${namespace}].\n$allErrors")
+ a
+ }
+
+ val fcObject = udfservice.udfs.lookupFunctionClass(namespace, fName)
+
+ if (fcObject == null) {
+ SDE("Function not found: fname[%s] fnamespace[%s]. Currently
registered UDFs:\n%s", fName, namespace, udfservice.allFunctionClasses)
Review comment:
I imagine most cases people will not have any UDF's registered. So this will
just say "Curently registered UDFS:" and then be empty. Which is a bit
confusing. Maybe we should just log all registered UDFs to LogLevel.Info and if
people really want the list they can enable that? Also, change the error to
something like "namespace:fName"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services