Github user myui commented on a diff in the pull request:

    https://github.com/apache/incubator-hivemall/pull/95#discussion_r125849451
  
    --- Diff: xgboost/src/main/java/hivemall/xgboost/XGBoostUDTF.java ---
    @@ -269,44 +274,33 @@ public void checkTargetValue(double target) throws 
HiveException {}
         public void process(Object[] args) throws HiveException {
             if (args[0] != null) {
                 // TODO: Need to support dense inputs
    -            final List<String> features = (List<String>) 
featureListOI.getList(args[0]);
    +            final List<?> features = (List<?>) 
featureListOI.getList(args[0]);
    +            final String[] fv = new String[features.size()];
    +            for (int i = 0; i < features.size(); i++) {
    +                fv[i] = (String) 
featureElemOI.getPrimitiveJavaObject(features.get(i));
    +            }
                 double target = 
PrimitiveObjectInspectorUtils.getDouble(args[1], this.targetOI);
                 checkTargetValue(target);
    -            final LabeledPoint point = XGBoostUtils.parseFeatures(target, 
features);
    +            final LabeledPoint point = XGBoostUtils.parseFeatures(target, 
fv);
                 if (point != null) {
                     this.featuresList.add(point);
                 }
             }
         }
     
    -    /**
    -     * Need to override this for a Spark wrapper because `MapredContext` 
does not work in there.
    -     */
    -    protected String generateUniqueModelId() {
    -        return "xgbmodel-" + String.valueOf(HadoopUtils.getTaskId());
    +    private String generateUniqueModelId() {
    +        return "xgbmodel-" + taskId + "-" + RandomUtils.getUUID() + "-" + 
sequence++;
    --- End diff --
    
    If one model per a task, `RandomUtils.getUUID()` is enough. 
    
    It's synchronized and thus would be safe enough for Spark multiple thread 
execution.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to