github-code-scanning[bot] commented on code in PR #13799:
URL: https://github.com/apache/druid/pull/13799#discussion_r1105192799


##########
processing/src/test/java/org/apache/druid/segment/UnnestStorageAdapterTest.java:
##########
@@ -249,151 +248,44 @@
       unnest 2 rows -> 16 entries also the value cardinality
       unnest of unnest -> 16*8 = 128 rows
        */
-      Assert.assertEquals(count, 128);
-      Assert.assertEquals(dimSelector.getValueCardinality(), 16);
+      Assert.assertEquals(128, count);
+      Assert.assertEquals(16, dimSelector.getValueCardinality());
       return null;
     });
   }
 
   @Test
-  public void test_unnest_adapters_with_allowList()
+  public void test_unnest_adapters_basic_with_filter()
   {
-    final String columnName = "multi-string1";
-
-    Sequence<Cursor> cursorSequence = UNNEST_STORAGE_ADAPTER1.makeCursors(
-        null,
-        UNNEST_STORAGE_ADAPTER1.getInterval(),
+    Filter f = new InDimFilter(OUTPUT_COLUMN_NAME, ImmutableSet.of("1", "3", 
"5"));
+    Sequence<Cursor> cursorSequence = UNNEST_STORAGE_ADAPTER.makeCursors(
+        f,
+        UNNEST_STORAGE_ADAPTER.getInterval(),
         VirtualColumns.EMPTY,
         Granularities.ALL,
         false,
         null
     );
 
+    List<String> expectedResults = Arrays.asList("1", "3", "5");
     cursorSequence.accumulate(null, (accumulated, cursor) -> {
       ColumnSelectorFactory factory = cursor.getColumnSelectorFactory();
 
       DimensionSelector dimSelector = 
factory.makeDimensionSelector(DefaultDimensionSpec.of(OUTPUT_COLUMN_NAME));
-      ColumnValueSelector valueSelector = 
factory.makeColumnValueSelector(OUTPUT_COLUMN_NAME);
-
       int count = 0;
       while (!cursor.isDone()) {
         Object dimSelectorVal = dimSelector.getObject();
-        Object valueSelectorVal = valueSelector.getObject();
         if (dimSelectorVal == null) {
           Assert.assertNull(dimSelectorVal);
-        } else if (valueSelectorVal == null) {
-          Assert.assertNull(valueSelectorVal);
         }
+        Assert.assertEquals(expectedResults.get(count), 
dimSelectorVal.toString());

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [dimSelectorVal](1) may be null at this access as suggested by 
[this](2) null guard.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/4265)



-- 
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