srinipunuru commented on a change in pull request #911: Support for types in 
Samza SQL UDF
URL: https://github.com/apache/samza/pull/911#discussion_r254888242
 
 

 ##########
 File path: 
samza-sql/src/main/java/org/apache/samza/sql/data/SamzaSqlExecutionContext.java
 ##########
 @@ -52,16 +54,19 @@ private SamzaSqlExecutionContext(SamzaSqlExecutionContext 
other) {
 
   public SamzaSqlExecutionContext(SamzaSqlApplicationConfig config) {
     this.sqlConfig = config;
-    udfMetadata =
-        
this.sqlConfig.getUdfMetadata().stream().collect(Collectors.toMap(UdfMetadata::getName,
 Function.identity()));
+    udfMetadata = new HashMap<>();
+    for(UdfMetadata udf : this.sqlConfig.getUdfMetadata()) {
+      udfMetadata.putIfAbsent(udf.getName(), new ArrayList<>());
+      udfMetadata.get(udf.getName()).add(udf);
+    }
   }
 
   public ScalarUdf getOrCreateUdf(String clazz, String udfName) {
     return udfInstances.computeIfAbsent(udfName, s -> createInstance(clazz, 
udfName));
   }
 
   public ScalarUdf createInstance(String clazz, String udfName) {
-    Config udfConfig = udfMetadata.get(udfName).getUdfConfig();
+    Config udfConfig = udfMetadata.get(udfName).get(0).getUdfConfig();
 
 Review comment:
   Please see @weiqingy 's comment and the corresponding answer. There can be 
several UDF methods within an UDF class config should be associated at the 
class level. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to