samza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] srinipunuru commented on a change in pull request #911: Support for types in Samza SQL UDF
Date Thu, 07 Feb 2019 22:22:31 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message