Skip to content
Open
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.5.4</version>
<configuration>
<!-- locale settings must be set on the command line before startup -->
<!-- set default options -->
Expand Down
5 changes: 5 additions & 0 deletions processing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-migrationsupport</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
import com.fasterxml.jackson.databind.Module;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import junitparams.naming.TestCaseName;
import org.apache.druid.data.input.impl.DimensionSchema;
import org.apache.druid.data.input.impl.DimensionsSpec;
import org.apache.druid.data.input.impl.LongDimensionSchema;
Expand Down Expand Up @@ -57,33 +54,36 @@
import org.apache.druid.segment.nested.StructuredData;
import org.apache.druid.segment.virtual.NestedFieldVirtualColumn;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.migrationsupport.EnableJUnit4MigrationSupport;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@RunWith(JUnitParamsRunner.class)
@EnableJUnit4MigrationSupport
public class NestedDataScanQueryTest extends InitializedNullHandlingTest
{
private static final Logger LOG = new Logger(NestedDataScanQueryTest.class);

DefaultColumnFormatConfig DEFAULT_FORMAT = new DefaultColumnFormatConfig(null, null, null);

private final AggregationTestHelper helper;
private final Closer closer;

@Rule
public final TemporaryFolder tempFolder = new TemporaryFolder();

private final AggregationTestHelper helper;
private final Closer closer;

public static Object[] getNestedColumnFormatSpec()
{
List<Object> specs = new ArrayList<>();
Expand Down Expand Up @@ -113,7 +113,7 @@ public static Object[] getNestedColumnFormatSpec()
return specs.toArray();
}

@After
@AfterEach
public void teardown() throws IOException
{
closer.close();
Expand Down Expand Up @@ -147,9 +147,8 @@ public void testIngestAndScanSegmentsSimple() throws Exception
logResults(results);
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsWithSpec(String name, boolean auto, NestedCommonFormatColumnFormatSpec spec)
throws Exception
{
Expand Down Expand Up @@ -180,9 +179,8 @@ public void testIngestAndScanSegmentsWithSpec(String name, boolean auto, NestedC
logResults(results);
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsNumericWithSpec(
String name,
boolean auto,
Expand Down Expand Up @@ -233,9 +231,9 @@ public void testIngestAndScanSegmentsNumericWithSpec(
}
}

@Test
@Parameters({"true", "false"})
public void testIngestAndScanSegmentsNumericRollup(boolean rollup) throws Exception
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testIngestAndScanSegmentsNumericRollup(Boolean rollup) throws Exception
{
Query<ScanResultValue> scanQuery = queryBuilder()
.virtualColumns(new NestedFieldVirtualColumn("nest", "$.long", "long"))
Expand Down Expand Up @@ -326,9 +324,8 @@ public void testIngestAndScanSegmentsRealtimeWithFallback() throws Exception
Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), resultsSegments.get(0).getEvents().toString());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsTsv(String name, boolean auto, NestedCommonFormatColumnFormatSpec spec)
throws Exception
{
Expand Down Expand Up @@ -403,9 +400,8 @@ public void testIngestWithMoreMergesAndScanSegmentsRollup() throws Exception
logResults(results);
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsAndFilter(String name, boolean auto, NestedCommonFormatColumnFormatSpec spec)
throws Exception
{
Expand All @@ -432,9 +428,8 @@ public void testIngestAndScanSegmentsAndFilter(String name, boolean auto, Nested
Assert.assertEquals(1, ((List) results.get(0).getEvents()).size());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsAndRangeFilter(
String name,
boolean auto,
Expand Down Expand Up @@ -488,17 +483,16 @@ public void testIngestAndScanSegmentsRealtimeSchemaDiscovery() throws Exception
Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), resultsSegments.get(0).getEvents().toString());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsRealtimeAutoExplicit(
String name,
boolean auto,
NestedCommonFormatColumnFormatSpec spec
) throws Exception
{
// Test with different column format spec
Assume.assumeTrue(auto);
Assumptions.assumeTrue(auto);
DimensionsSpec dimensionsSpec = DimensionsSpec.builder()
.setDimensions(
List.of(
Expand Down Expand Up @@ -612,9 +606,8 @@ public void testIngestAndScanSegmentsRealtimeSchemaDiscoveryTypeGauntlet() throw
Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), resultsSegments.get(0).getEvents().toString());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex(
String name,
boolean auto,
Expand Down Expand Up @@ -658,9 +651,8 @@ public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex(
Assert.assertEquals(results.get(0).getEvents().toString(), resultsRealtime.get(0).getEvents().toString());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsAndFilterPartialPath(
String name,
boolean auto,
Expand Down Expand Up @@ -701,9 +693,8 @@ public void testIngestAndScanSegmentsAndFilterPartialPath(
Assert.assertEquals(results.get(0).getEvents().toString(), resultsRealtime.get(0).getEvents().toString());
}

@Test
@Parameters(method = "getNestedColumnFormatSpec")
@TestCaseName("{0}")
@ParameterizedTest(name = "{0}")
@MethodSource("getNestedColumnFormatSpec")
public void testIngestAndScanSegmentsNestedColumnNotNullFilter(
String name,
boolean auto,
Expand Down
Loading