private static void sparseProbabilisticPromotionTest(final ISchemaVersion schemaVersion) throws IOException {
  final Writer output=openOutput(schemaVersion,"sparse_promotion",TestType.UNION);
  final Random random=new Random(randomLong());
  final HLL hll=newHLL(HLLType.EMPTY);
  final HLL emptyHLL=newHLL(HLLType.EMPTY);
  cumulativeUnionLine(output,hll,emptyHLL,schemaVersion);
  for (int i=0; i < (SPARSE_THRESHOLD + 1000); i++) {
    final HLL sparseHLL=newHLL(HLLType.SPARSE);
    final int registerIndex=Math.abs(random.nextInt()) % REGISTER_COUNT;
    final int registerValue=((Math.abs(random.nextInt()) % REGISTER_MAX_VALUE) + 1);
    final long rawValue=constructHLLValue(LOG2M,registerIndex,registerValue);
    sparseHLL.addRaw(rawValue);
    cumulativeUnionLine(output,hll,sparseHLL,schemaVersion);
  }
  output.flush();
  output.close();
}

private static void sparseProbabilisticPromotionTest ( final ISchemaVersion schemaVersion ) throws IOException { final Writer output = openOutput ( schemaVersion , "sparse_promotion" , TestType . UNION ) ; final Random random = new Random ( randomLong ( ) ) ; final HLL hll = newHLL ( HLLType . EMPTY ) ; final HLL emptyHLL = newHLL ( HLLType . EMPTY ) ; cumulativeUnionLine ( output , hll , emptyHLL , schemaVersion ) ; for ( int i = 0 ; i < ( SPARSE_THRESHOLD + 1000 ) ; i ++ ) { final HLL sparseHLL = newHLL ( HLLType . SPARSE ) ; final int registerIndex = Math . abs ( random . nextInt ( ) ) % REGISTER_COUNT ; final int registerValue = ( ( Math . abs ( random . nextInt ( ) ) % REGISTER_MAX_VALUE ) + 1 ) ; final long rawValue = constructHLLValue ( LOG2M , registerIndex , registerValue ) ; sparseHLL . addRaw ( rawValue ) ; cumulativeUnionLine ( output , hll , sparseHLL , schemaVersion ) ; } output . flush ( ) ; output . close ( ) ; }
unions an empty accumulator with sparse hlls , each having one register set . format : cumulative union tests : - empty u sparse - sparse u sparse - sparse promotion - sparse u full
