gparai commented on a change in pull request #729: Drill 1328: Support table
statistics for Parquet
URL: https://github.com/apache/drill/pull/729#discussion_r256615687
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StatisticsAggrFunctions.java
##########
@@ -5513,4 +5514,1517 @@ public void reset() {
nonNullCount.value = 0;
}
}
+
+ @FunctionTemplate(name = "approx_count_dups", scope =
FunctionTemplate.FunctionScope.POINT_AGGREGATE)
+ public static class BitCntDupsFunction implements DrillAggFunc {
+ @Param
+ BitHolder in;
+ @Workspace
+ ObjectHolder work;
+ @Workspace BigIntHolder dups;
+ @Output NullableBigIntHolder out;
+ @Inject OptionManager options;
+ @Workspace IntHolder ndvBloomFilterElts;
+ @Workspace IntHolder ndvBloomFilterFPProb;
+
+ @Override
+ public void setup() {
+ work = new ObjectHolder();
+ ndvBloomFilterElts.value = (int)
options.getLong(org.apache.drill.exec.ExecConstants.NDV_BLOOM_FILTER_ELEMENTS);
+ ndvBloomFilterFPProb.value = (int)
options.getLong(org.apache.drill.exec.ExecConstants.NDV_BLOOM_FILTER_FPOS_PROB);
+ work.obj = new
com.clearspring.analytics.stream.membership.BloomFilter(ndvBloomFilterElts.value,
ndvBloomFilterFPProb.value);
+ }
+
+ @Override
+ public void add() {
+ if (work.obj != null) {
+ com.clearspring.analytics.stream.membership.BloomFilter filter =
+ (com.clearspring.analytics.stream.membership.BloomFilter )
work.obj;
+ if (!filter.isPresent(String.valueOf(in.value))) {
+ filter.add(String.valueOf(in.value));
+ } else {
+ dups.value++;
+ }
+ }
+ }
+
+ @Override
+ public void output() {
+ if (work.obj != null) {
+ com.clearspring.analytics.stream.membership.BloomFilter filter =
+ (com.clearspring.analytics.stream.membership.BloomFilter )
work.obj;
+ out.isSet = 1;
+ out.value = dups.value;
+ } else {
+ out.isSet = 0;
+ }
+ }
+
+ @Override
+ public void reset() {
Review comment:
Done
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services