[ 
https://issues.apache.org/jira/browse/METRON-627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15754805#comment-15754805
 ] 

ASF GitHub Bot commented on METRON-627:
---------------------------------------

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

    https://github.com/apache/incubator-metron/pull/397#discussion_r92836067
  
    --- Diff: 
metron-platform/metron-common/src/main/java/org/apache/metron/common/utils/ConversionUtils.java
 ---
    @@ -18,23 +18,41 @@
     
     package org.apache.metron.common.utils;
     
    +import com.google.common.collect.Lists;
     import org.apache.commons.beanutils.BeanUtilsBean2;
     import org.apache.commons.beanutils.ConvertUtilsBean;
     
    +import java.util.List;
    +
     public class ConversionUtils {
    -  private static ThreadLocal<ConvertUtilsBean> UTILS_BEAN  = new 
ThreadLocal<ConvertUtilsBean>() {
    +  private static ThreadLocal<ConvertUtilsBean> UTILS_BEAN = new 
ThreadLocal<ConvertUtilsBean>() {
         @Override
         protected ConvertUtilsBean initialValue() {
           ConvertUtilsBean ret = 
BeanUtilsBean2.getInstance().getConvertUtils();
           ret.deregister();
    -      ret.register(false,true, 1);
    +      ret.register(false, true, 1);
           return ret;
         }
       };
    +
       public static <T> T convert(Object o, Class<T> clazz) {
    -    if(o == null) {
    +    if (o == null) {
           return null;
         }
         return clazz.cast(UTILS_BEAN.get().convert(o, clazz));
       }
    +
    +  /**
    +   * Performs naive List type conversion.
    +   *
    +   * @param from Source list
    +   * @param clazz Class type to cast the List elements to
    +   * @param <T> Source element type
    +   * @param <U> Desired element type
    +   * @return New List with the elements cast to the desired type
    +   */
    +  public static <T, U> List<U> convertList(List<T> from, Class<U> clazz) {
    +    return Lists.transform(from, s -> clazz.cast(s));
    --- End diff --
    
    My issue with this is that above we are calling `convert` and is a coercive 
operation (e.g. convert("1", Integer.class) == 1) rather than just a simple 
cast.  Can you make `convertList` call `convert` on the elements?  If you 
really want a naive version of this, feel free to make a `castList` method.


> Add HyperLogLogPlus implementation to Stellar
> ---------------------------------------------
>
>                 Key: METRON-627
>                 URL: https://issues.apache.org/jira/browse/METRON-627
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Michael Miklavcic
>
> Calculating set cardinality can be a useful tool for a security analyst. For 
> instance, a large volume of non-unique src ip addresses hitting your network 
> may be an indication that you are currently under attack. There have been 
> many advancements in distinct value (DV) estimation over the years. We have 
> seen implementations evolve from K-Minimum-Values (KMV), to LogLog, to 
> HyperLogLog, and now to Google's much-improved HyperLogLogPlu algorithm. The 
> key improvements in this latest manifestation of the algorithm are:
> moves to a 64-bit hash
> handles sparse sets
> is more accurate with small cardinality
> This Jira tracks the effort to add a HyperLogLogPlus implementation to Metron.
> References:
> https://research.neustar.biz/2013/01/24/hyperloglog-googles-take-on-engineering-hll/
> http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/40671.pdf



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to