Hi Yuming, `rescale` function should return null if input value contains null. So, if(value is null, null, rescale(value, min_value, max_value)) is a workaround.
Due to unboxing, NPE would be happen. So, better to fix the implementation to avoid unboxing (evaluate method w/ primitive values) and handle null values in https://github.com/apache/incubator-hivemall/blob/master/core/src/main/java/hivemall/ftvec/scaling/RescaleUDF.java#L39 | public FloatWritable evaluate(final float value, final float min, final float max) { | return val(min_max_normalization(value, min, max)); | } | | @Nullable | public FloatWritable evaluate(final Float value, final Float min, final Float max) throws HiveException { | if(value == null) { | return null; | } | if(min == null) throw new HiveException("min should not be null"); | if(max == null) throw new HiveException("max should not be null"); | | return val(min_max_normalization(value.floatValue(), min.floatValue(), max. floatValue())); | } BTW, it's better to move this thread to [email protected]. Thanks, Makoto 2017-02-13 14:08 GMT+09:00 Yuming Wang <[email protected]>: > hi: > > How to deal with > <http://www.baidu.com/link?url=gXuNJjK_D8dbqNxLwXQO4KfU9lIUyyE6Cyt54hx68EVKcnohBk0ZyRbBAje7p4Kgt7h34FGpwk8YEnqAVspGw4iP0esmMTaUPkVfdaqsRNi> > null > value here? > > https://github.com/apache/incubator-hivemall/blob/master/core/src/main/java/hivemall/ftvec/scaling/RescaleUDF.java#L81
