github-advanced-security[bot] commented on code in PR #18722:
URL: https://github.com/apache/druid/pull/18722#discussion_r2506163602


##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -132,75 +147,66 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsRollup() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsWithSpec(String name, boolean auto, 
NestedCommonFormatColumnFormatSpec spec)

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10546)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -132,75 +147,66 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsRollup() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsWithSpec(String name, boolean auto, 
NestedCommonFormatColumnFormatSpec spec)
+      throws Exception
   {
-    Query<ScanResultValue> scanQuery = Druids.newScanQueryBuilder()
-                                             .dataSource("test_datasource")
-                                             .intervals(
-                                                 new 
MultipleIntervalSegmentSpec(
-                                                     
Collections.singletonList(Intervals.ETERNITY)
-                                                 )
-                                             )
-                                             .virtualColumns(
-                                                 new 
NestedFieldVirtualColumn("nest", "$.long", "long")
-                                             )
-                                             
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
-                                             .limit(100)
-                                             .context(ImmutableMap.of())
-                                             .build();
-    List<Segment> segs = ImmutableList.<Segment>builder().addAll(
-        NestedDataTestUtils.createSegments(
-            tempFolder,
-            closer,
-            NestedDataTestUtils.NUMERIC_DATA_FILE,
-            TestIndex.DEFAULT_JSON_INPUT_FORMAT,
-            NestedDataTestUtils.TIMESTAMP_SPEC,
-            NestedDataTestUtils.AUTO_DISCOVERY,
-            TransformSpec.NONE,
-            NestedDataTestUtils.COUNT,
-            Granularities.YEAR,
-            true,
-            IndexSpec.getDefault()
+    // Test with different column format spec
+    DimensionsSpec dimensionsSpec = DimensionsSpec.builder().setDimensions(
+        Stream.of("dim", "nest", "nester", "variant", "list")
+              .map(col -> auto
+                          ? new AutoTypeColumnSchema(col, null, spec)
+                          : new NestedDataColumnSchema(col, 5, spec, 
DEFAULT_FORMAT))
+              .collect(Collectors.toList())).build();
+    Query<ScanResultValue> scanQuery = queryBuilder()
+        .virtualColumns(
+            new NestedFieldVirtualColumn("nest", "$.x", "x"),
+            new NestedFieldVirtualColumn("nester", "$.x[0]", "x_0"),
+            new NestedFieldVirtualColumn("nester", "$.y.c[1]", "y_c_1")
         )
-    ).build();
+        .context(ImmutableMap.of())
+        .build();
+    List<Segment> segs = new NestedDataTestUtils.SegmentBuilder(tempFolder, 
closer).dimensionsSpec(dimensionsSpec)
+                                                                               
    .build();
 
     final Sequence<ScanResultValue> seq = helper.runQueryOnSegmentsObjs(segs, 
scanQuery);
 
     List<ScanResultValue> results = seq.toList();
-    logResults(results);
     Assert.assertEquals(1, results.size());
-    Assert.assertEquals(6, ((List) results.get(0).getEvents()).size());
+    Assert.assertEquals(8, ((List) results.get(0).getEvents()).size());
+    logResults(results);
   }
 
   @Test
-  public void testIngestAndScanSegmentsRealtime() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsNumericWithSpec(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10545)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -282,94 +281,66 @@
     logResults(resultsRealtime);
     Assert.assertEquals(1, resultsRealtime.size());
     Assert.assertEquals(resultsRealtime.size(), resultsSegments.size());
-    Assert.assertEquals(resultsSegments.get(0).getEvents().toString(), 
resultsRealtime.get(0).getEvents().toString());
+    Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), 
resultsSegments.get(0).getEvents().toString());
   }
 
   @Test
-  @Parameters(method = "getNestedColumnFormatSpec")
-  @TestCaseName("{0}")
-  public void testIngestAndScanSegmentsTsvV4(String name, 
NestedCommonFormatColumnFormatSpec spec) throws Exception
+  public void testIngestAndScanSegmentsRealtimeWithFallback() throws Exception
   {
-    Query<ScanResultValue> scanQuery = Druids.newScanQueryBuilder()
-                                             .dataSource("test_datasource")
-                                             .intervals(
-                                                 new 
MultipleIntervalSegmentSpec(
-                                                     
Collections.singletonList(Intervals.ETERNITY)
-                                                 )
-                                             )
-                                             .virtualColumns(
-                                                 new 
NestedFieldVirtualColumn("nest", "$.x", "x"),
-                                                 new 
NestedFieldVirtualColumn("nester", "$.x[0]", "x_0"),
-                                                 new 
NestedFieldVirtualColumn("nester", "$.y.c[1]", "y_c_1")
-                                             )
-                                             
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
-                                             .limit(100)
-                                             .context(ImmutableMap.of())
-                                             .build();
-    List<Segment> segs = 
NestedDataTestUtils.createSimpleSegmentsTsvNested(tempFolder, spec, closer);
+    VirtualColumns virtualColumns = VirtualColumns.create(
+        new NestedFieldVirtualColumn("nest", "x", ColumnType.LONG, null, true, 
"$.x", false),
+        new NestedFieldVirtualColumn("nester", "x_0", ColumnType.NESTED_DATA, 
null, true, "$.x[0]", false),
+        new NestedFieldVirtualColumn("nester", "y_c_1", 
ColumnType.NESTED_DATA, null, true, "$.y.c[1]", false),
+        new NestedFieldVirtualColumn("nester", "nester_root", 
ColumnType.NESTED_DATA, null, true, "$.", false)
+    );
+    Query<ScanResultValue> scanQuery = queryBuilder().columns("x", "x_0", 
"y_c_1")
+                                                     
.virtualColumns(virtualColumns)
+                                                     .build();
+    NestedDataTestUtils.SegmentBuilder builder = new 
NestedDataTestUtils.SegmentBuilder(tempFolder, closer);
+    List<Segment> realtimeSegs = ImmutableList.of(builder.buildIncremental());
+    List<Segment> segs = builder.build();
 
-    final Sequence<ScanResultValue> seq = helper.runQueryOnSegmentsObjs(segs, 
scanQuery);
+    final Sequence<ScanResultValue> seq = 
helper.runQueryOnSegmentsObjs(realtimeSegs, scanQuery);
+    final Sequence<ScanResultValue> seq2 = helper.runQueryOnSegmentsObjs(segs, 
scanQuery);
 
-    List<ScanResultValue> results = seq.toList();
-    Assert.assertEquals(1, results.size());
-    Assert.assertEquals(8, ((List) results.get(0).getEvents()).size());
-    logResults(results);
+    List<ScanResultValue> resultsRealtime = seq.toList();
+    List<ScanResultValue> resultsSegments = seq2.toList();
+    logResults(resultsSegments);
+    logResults(resultsRealtime);
+    Assert.assertEquals(1, resultsRealtime.size());
+    Assert.assertEquals(resultsRealtime.size(), resultsSegments.size());
+    Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), 
resultsSegments.get(0).getEvents().toString());
   }
 
   @Test
   @Parameters(method = "getNestedColumnFormatSpec")
   @TestCaseName("{0}")
-  public void testIngestAndScanSegmentsTsv(String name, 
NestedCommonFormatColumnFormatSpec spec) throws Exception
+  public void testIngestAndScanSegmentsTsv(String name, boolean auto, 
NestedCommonFormatColumnFormatSpec spec)

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10544)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -475,35 +418,27 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsAndRangeFilter() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsAndRangeFilter(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10542)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -867,50 +625,32 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsAndFilterPartialPath() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsAndFilterPartialPath(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10539)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -925,49 +665,32 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsNestedColumnNotNullFilter() throws 
Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsNestedColumnNotNullFilter(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10538)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -445,26 +390,24 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsAndFilter() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsAndFilter(String name, boolean auto, 
NestedCommonFormatColumnFormatSpec spec)

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10543)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -568,58 +470,34 @@
   }
 
   @Test
-  public void testIngestAndScanSegmentsRealtimeAutoExplicit() throws Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsRealtimeAutoExplicit(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10541)



##########
processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java:
##########
@@ -805,54 +578,39 @@
         "[[1672531200000, null, null, null, 1, 51, -0.13, 1, [], [51, -35], 
{a=700, b={x=g, y=1.1, z=[9, null, 9, 9]}, c=null, v=[]}, {x=400, y=[{l=[null], 
m=100, n=5}, {l=[a, b, c], m=a, n=1}], z={}}, null, [a, b], null, [2, 3], null, 
[null], null, [1, 0, 1], null, [{x=1}, {x=2}], null, hello, 1234, 1.234, {x=1, 
y=hello, z={a=1.1, b=1234, c=[a, b, c], d=[]}}, [a, b, c], [1, 2, 3], [1.1, 
2.2, 3.3], [], {}, [null, null], [{}, {}, {}], [{a=b, x=1, y=1.3}], 1], 
[1672531200000, , 2, null, 0, b, 1.1, b, 2, b, {a=200, b={x=b, y=1.1, z=[2, 4, 
6]}, c=[a, b], v=[]}, {x=10, y=[{l=[b, b, c], m=b, n=2}, [1, 2, 3]], 
z={a=[5.5], b=false}}, [a, b, c], [null, b], [2, 3], null, [3.3, 4.4, 5.5], 
[999.0, null, 5.5], [null, null, 2.2], [1, 1], [null, [null], []], [{x=3}, 
{x=4}], null, hello, 1234, 1.234, {x=1, y=hello, z={a=1.1, b=1234, c=[a, b, c], 
d=[]}}, [a, b, c], [1, 2, 3], [1.1, 2.2, 3.3], [], {}, [null, null], [{}, {}, 
{}], [{a=b, x=1, y=1.3}], 1], [1672531200000, a, 1, 1.0, 1, 1, 1, 1, 1, 1, {a
 =100, b={x=a, y=1.1, z=[1, 2, 3, 4]}, c=[100], v=[]}, {x=1234, y=[{l=[a, b, 
c], m=a, n=1}, {l=[a, b, c], m=a, n=1}], z={a=[1.1, 2.2, 3.3], b=true}}, [a, 
b], [a, b], [1, 2, 3], [1, null, 3], [1.1, 2.2, 3.3], [1.1, 2.2, null], [a, 1, 
2.2], [1, 0, 1], [[1, 2, null], [3, 4]], [{x=1}, {x=2}], null, hello, 1234, 
1.234, {x=1, y=hello, z={a=1.1, b=1234, c=[a, b, c], d=[]}}, [a, b, c], [1, 2, 
3], [1.1, 2.2, 3.3], [], {}, [null, null], [{}, {}, {}], [{a=b, x=1, y=1.3}], 
1], [1672531200000, b, 4, 3.3, 1, 1, null, {}, 4, 1, {a=400, b={x=d, y=1.1, 
z=[3, 4]}, c={a=1}, v=[]}, {x=1234, z={a=[1.1, 2.2, 3.3], b=true}}, [d, e], [b, 
b], [1, 4], [1], [2.2, 3.3, 4.0], null, [a, b, c], [null, 0, 1], [[1, 2], [3, 
4], [5, 6, 7]], [{x=null}, {x=2}], null, hello, 1234, 1.234, {x=1, y=hello, 
z={a=1.1, b=1234, c=[a, b, c], d=[]}}, [a, b, c], [1, 2, 3], [1.1, 2.2, 3.3], 
[], {}, [null, null], [{}, {}, {}], [{a=b, x=1, y=1.3}], 1], [1672531200000, c, 
null, 4.4, 1, hello, -1000, {}, [], hello, {a=500, b={x=e, z=[1,
  2, 3, 4]}, c=hello, v=a}, {x=11, y=[], z={a=[null], b=false}}, null, null, 
[1, 2, 3], [], [1.1, 2.2, 3.3], null, null, [0], null, [{x=1000}, {y=2000}], 
null, hello, 1234, 1.234, {x=1, y=hello, z={a=1.1, b=1234, c=[a, b, c], d=[]}}, 
[a, b, c], [1, 2, 3], [1.1, 2.2, 3.3], [], {}, [null, null], [{}, {}, {}], 
[{a=b, x=1, y=1.3}], 1], [1672531200000, d, 5, 5.9, 0, null, 3.33, a, 6, null, 
{a=600, b={x=f, y=1.1, z=[6, 7, 8, 9]}, c=12.3, v=b}, null, [a, b], null, null, 
[null, 2, 9], null, [999.0, 5.5, null], [a, 1, 2.2], [], [[1], [1, 2, null]], 
[{a=1}, {b=2}], null, hello, 1234, 1.234, {x=1, y=hello, z={a=1.1, b=1234, 
c=[a, b, c], d=[]}}, [a, b, c], [1, 2, 3], [1.1, 2.2, 3.3], [], {}, [null, 
null], [{}, {}, {}], [{a=b, x=1, y=1.3}], 1], [1672531200000, null, 3, 2.0, 
null, 3.0, 1.0, 3.3, 3, 3.0, {a=300}, {x=4.4, y=[{l=[], m=100, n=3}, {l=[a]}, 
{l=[b], n=[]}], z={a=[], b=true}}, [b, c], [d, null, b], [1, 2, 3, 4], [1, 2, 
3], [1.1, 3.3], [null, 2.2, null], [1, null, 1], [1, null, 1], [[1], n
 ull, [1, 2, 3]], [null, {x=2}], null, hello, 1234, 1.234, {x=1, y=hello, 
z={a=1.1, b=1234, c=[a, b, c], d=[]}}, [a, b, c], [1, 2, 3], [1.1, 2.2, 3.3], 
[], {}, [null, null], [{}, {}, {}], [{a=b, x=1, y=1.3}], 1]]",
         resultsSegments.get(0).getEvents().toString()
     );
-    Assert.assertEquals(resultsSegments.get(0).getEvents().toString(), 
resultsRealtime.get(0).getEvents().toString());
+    Assert.assertEquals(resultsRealtime.get(0).getEvents().toString(), 
resultsSegments.get(0).getEvents().toString());
   }
 
   @Test
-  public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex() throws 
Exception
+  @Parameters(method = "getNestedColumnFormatSpec")
+  @TestCaseName("{0}")
+  public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex(
+      String name,

Review Comment:
   ## Useless parameter
   
   The parameter 'name' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10540)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to