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

    https://github.com/apache/incubator-metron/pull/397#discussion_r92847280
  
    --- Diff: 
metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/DataStructureFunctions.java
 ---
    @@ -137,6 +138,105 @@ public Object apply(List<Object> args) {
         }
       }
     
    +  @Stellar( namespace="HLLP"
    +          , name="CARDINALITY"
    +          , description="Returns HyperLogLogPlus-estimated cardinality for 
this set"
    +          , params = { "hyperLogLogPlus - the hllp set" }
    +          , returns = "Long value representing the cardinality for this 
set"
    +  )
    +  public static class HLLPCardinality extends BaseStellarFunction {
    +
    +    @Override
    +    public Object apply(List<Object> args) {
    +      if (args.size() < 1) {
    +        throw new IllegalArgumentException("Must pass an hllp set to get 
the cardinality for");
    +      }
    +      return ((HyperLogLogPlus) args.get(0)).cardinality();
    +    }
    +  }
    +
    +  @Stellar( namespace="HLLP"
    +          , name="INIT"
    +          , description="Initializes the set"
    +          , params = {
    +                      "p (required) - the precision value for the normal 
set"
    +                     ,"sp - the precision value for the sparse set. If sp 
is not specified the sparse set will be disabled."
    +                     }
    +          , returns = "A new HyperLogLogPlus set"
    +  )
    +  public static class HLLPInit extends BaseStellarFunction {
    +
    +    @Override
    +    public Object apply(List<Object> args) {
    +      if (args.size() == 0) {
    +        throw new IllegalArgumentException("Normal set precision is 
required");
    +      } else if (args.size() == 1) {
    +        int p = ConversionUtils.convert(args.get(0), Integer.class);
    +        return new HyperLogLogPlus(p);
    +      } else {
    +        int p = ConversionUtils.convert(args.get(0), Integer.class);
    +        int sp = ConversionUtils.convert(args.get(1), Integer.class);
    +        return new HyperLogLogPlus(p, sp);
    +      }
    +    }
    +  }
    +
    +  @Stellar( namespace="HLLP"
    +          , name="MERGE"
    +          , description="Merge hllp sets together"
    +          , params = {
    +                      "hllp1 - first hllp set"
    --- End diff --
    
    Agreed.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to