Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ static void updateUnion(Union union, Object update)
union.update((long[]) update);
} else if (update instanceof List) {
for (Object entry : (List) update) {
union.update(entry.toString());
if (entry != null) {
union.update(entry.toString());
}
}
} else {
throw new ISE("Illegal type received while theta sketch merging [%s]", update.getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
import org.apache.druid.java.util.common.guava.Sequence;
import org.apache.druid.query.Query;
import org.apache.druid.query.aggregation.AggregationTestHelper;
import org.apache.druid.query.aggregation.Aggregator;
import org.apache.druid.query.aggregation.AggregatorFactory;
import org.apache.druid.query.aggregation.PostAggregator;
import org.apache.druid.query.aggregation.TestObjectColumnSelector;
import org.apache.druid.query.aggregation.post.FieldAccessPostAggregator;
import org.apache.druid.query.groupby.GroupByQuery;
import org.apache.druid.query.groupby.GroupByQueryConfig;
Expand Down Expand Up @@ -493,6 +495,25 @@ public void testRelocation()
Assert.assertEquals(holders[0].getEstimate(), holders[1].getEstimate(), 0);
}

@Test
public void testUpdateUnionWithNullInList()
{
List<String> value = new ArrayList<>();
value.add("foo");
value.add(null);
value.add("bar");
List[] columnValues = new List[]{value};
final TestObjectColumnSelector selector = new TestObjectColumnSelector(columnValues);
final Aggregator agg = new SketchAggregator(selector, 4096);
agg.aggregate();
Assert.assertFalse(agg.isNull());
Assert.assertNotNull(agg.get());
Assert.assertTrue(agg.get() instanceof SketchHolder);
Assert.assertEquals(2, ((SketchHolder) agg.get()).getEstimate(), 0);
Assert.assertNotNull(((SketchHolder) agg.get()).getSketch());
Assert.assertEquals(2, ((SketchHolder) agg.get()).getSketch().getEstimate(), 0);
}

private void assertPostAggregatorSerde(PostAggregator agg) throws Exception
{
Assert.assertEquals(
Expand Down