protected void testAggregation(Object expectedValue, Block... blocks) { assertAggregation(getFunction(), expectedValue, blocks); } }
@Test public void testAllPositionsNull() { // if there are no parameters skip this test List<Type> parameterTypes = getFunction().getParameterTypes(); if (parameterTypes.isEmpty()) { return; } Block[] blocks = new Block[parameterTypes.size()]; for (int i = 0; i < parameterTypes.size(); i++) { blocks[i] = RunLengthEncodedBlock.create(parameterTypes.get(0), null, 10); } testAggregation(getExpectedValueIncludingNulls(0, 0, 10), blocks); }
@Test public void testMixedNullAndNonNullPositions() { // if there are no parameters skip this test List<Type> parameterTypes = getFunction().getParameterTypes(); if (parameterTypes.isEmpty()) { return; } Block[] alternatingNullsBlocks = createAlternatingNullsBlock(parameterTypes, getSequenceBlocks(0, 10)); testAggregation(getExpectedValueIncludingNulls(0, 10, 20), alternatingNullsBlocks); }
protected void testAggregation(Object expectedValue, Block... blocks) { assertAggregation(getFunction(), getConfidence(), expectedValue, blocks); } }
@Test public void testMixedNullAndNonNullPositions() { // if there are no parameters skip this test List<Type> parameterTypes = getFunction().getParameterTypes(); if (parameterTypes.isEmpty()) { return; } Block[] alternatingNullsBlocks = createAlternatingNullsBlock(parameterTypes, getSequenceBlocks(0, 10)); testAggregation(getExpectedValueIncludingNulls(0, 10, 20), alternatingNullsBlocks); }
@Test public void testAllPositionsNull() throws Exception { // if there are no parameters skip this test List<Type> parameterTypes = getFunction().getParameterTypes(); if (parameterTypes.isEmpty()) { return; } Block[] blocks = new Block[parameterTypes.size()]; for (int i = 0; i < parameterTypes.size(); i++) { Block nullValueBlock = parameterTypes.get(0).createBlockBuilder(new BlockBuilderStatus(), 1) .appendNull() .build(); blocks[i] = new RunLengthEncodedBlock(nullValueBlock, 10); } testAggregation(getExpectedValueIncludingNulls(0, 0, 10), blocks); }