From 0841c89df6de4cd6c8dba6b62651874e00ac3ed5 Mon Sep 17 00:00:00 2001 From: Atul Mohan Date: Mon, 29 Jun 2020 22:55:38 -0500 Subject: [PATCH] Fix nullhandling exception (#10095) Co-authored-by: Atul Mohan --- .../segment/realtime/appenderator/AppenderatorTest.java | 3 ++- .../realtime/appenderator/BatchAppenderatorDriverTest.java | 5 +++++ .../realtime/appenderator/StreamAppenderatorDriverTest.java | 5 +++++ .../segment/realtime/plumber/RealtimePlumberSchoolTest.java | 3 ++- .../org/apache/druid/segment/realtime/plumber/SinkTest.java | 3 ++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java index e5f811c74f5..76fe86542aa 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java @@ -45,6 +45,7 @@ import org.apache.druid.query.timeseries.TimeseriesQuery; import org.apache.druid.query.timeseries.TimeseriesResultValue; import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.realtime.plumber.Committers; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.apache.druid.timeline.DataSegment; import org.apache.druid.timeline.partition.LinearShardSpec; import org.junit.Assert; @@ -58,7 +59,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; -public class AppenderatorTest +public class AppenderatorTest extends InitializedNullHandlingTest { private static final List IDENTIFIERS = ImmutableList.of( si("2000/2001", "A", 0), diff --git a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriverTest.java b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriverTest.java index fbf33238f0b..b77662cffcd 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriverTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriverTest.java @@ -22,6 +22,7 @@ package org.apache.druid.segment.realtime.appenderator; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import org.apache.druid.common.config.NullHandling; import org.apache.druid.data.input.InputRow; import org.apache.druid.data.input.MapBasedInputRow; import org.apache.druid.indexing.overlord.SegmentPublishResult; @@ -75,6 +76,10 @@ public class BatchAppenderatorDriverTest extends EasyMockSupport private BatchAppenderatorDriver driver; private DataSegmentKiller dataSegmentKiller; + static { + NullHandling.initializeForTests(); + } + @Before public void setup() { diff --git a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverTest.java b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverTest.java index 1fa7f370d9f..87fc54b42a3 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverTest.java @@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.ListenableFuture; +import org.apache.druid.common.config.NullHandling; import org.apache.druid.data.input.Committer; import org.apache.druid.data.input.InputRow; import org.apache.druid.data.input.MapBasedInputRow; @@ -99,6 +100,10 @@ public class StreamAppenderatorDriverTest extends EasyMockSupport private StreamAppenderatorDriver driver; private DataSegmentKiller dataSegmentKiller; + static { + NullHandling.initializeForTests(); + } + @Before public void setUp() { diff --git a/server/src/test/java/org/apache/druid/segment/realtime/plumber/RealtimePlumberSchoolTest.java b/server/src/test/java/org/apache/druid/segment/realtime/plumber/RealtimePlumberSchoolTest.java index b91de1ba887..a98bb9800fb 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/plumber/RealtimePlumberSchoolTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/plumber/RealtimePlumberSchoolTest.java @@ -60,6 +60,7 @@ import org.apache.druid.segment.writeout.OffHeapMemorySegmentWriteOutMediumFacto import org.apache.druid.segment.writeout.SegmentWriteOutMediumFactory; import org.apache.druid.segment.writeout.TmpFileSegmentWriteOutMediumFactory; import org.apache.druid.server.coordination.DataSegmentAnnouncer; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.easymock.EasyMock; import org.joda.time.DateTime; import org.joda.time.Interval; @@ -83,7 +84,7 @@ import java.util.concurrent.TimeUnit; * */ @RunWith(Parameterized.class) -public class RealtimePlumberSchoolTest +public class RealtimePlumberSchoolTest extends InitializedNullHandlingTest { @Parameterized.Parameters(name = "rejectionPolicy = {0}, segmentWriteOutMediumFactory = {1}") public static Collection constructorFeeder() diff --git a/server/src/test/java/org/apache/druid/segment/realtime/plumber/SinkTest.java b/server/src/test/java/org/apache/druid/segment/realtime/plumber/SinkTest.java index 36446e3b624..df59fa7a686 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/plumber/SinkTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/plumber/SinkTest.java @@ -37,6 +37,7 @@ import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.indexing.TuningConfigs; import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec; import org.apache.druid.segment.realtime.FireHydrant; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.joda.time.DateTime; import org.joda.time.Interval; import org.joda.time.Period; @@ -48,7 +49,7 @@ import java.util.List; /** */ -public class SinkTest +public class SinkTest extends InitializedNullHandlingTest { @Test public void testSwap() throws Exception