Map<String, Integer> mapColumnNames = new HashMap<String, Integer>();
mapColumnNames.put("Key", 0);
mapColumnNames.put("Value", 1);
VectorizationContext ctx = new VectorizationContext(mapColumnNames, 2);
GroupByDesc desc = buildKeyGroupByDesc (ctx, "max",
"Value", TypeInfoFactory.longTypeInfo,
"Key", TypeInfoFactory.longTypeInfo);
// Set the memory treshold so that we get 100Kb before we need to flush.
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long maxMemory = memoryMXBean.getHeapMemoryUsage().getMax();
float treshold = 100.0f*1024.0f/maxMemory;
desc.setMemoryThreshold(treshold);
VectorGroupByOperator vgo = new VectorGroupByOperator(ctx, desc);
FakeCaptureOutputOperator out = FakeCaptureOutputOperator.addCaptureOutputChild(vgo);
vgo.initialize(null, null);