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


##########
processing/src/main/java/org/apache/druid/segment/CursorFactory.java:
##########
@@ -35,12 +38,55 @@
  */
 public interface CursorFactory
 {
+  default CursorMaker asCursorMaker(CursorBuildSpec spec)
+  {
+
+    return new CursorMaker()
+    {
+      @Override
+      public boolean canVectorize()
+      {
+        return CursorFactory.this.canVectorize(spec.getFilter(), 
spec.getVirtualColumns(), spec.isDescending());
+      }
+
+      @Override
+      public Sequence<Cursor> makeCursors()
+      {
+        return CursorFactory.this.makeCursors(
+            spec.getFilter(),
+            spec.getInterval(),
+            spec.getVirtualColumns(),
+            spec.getGranularity(),
+            spec.isDescending(),
+            spec.getQueryMetrics()
+        );

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CursorFactory.makeCursors](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7432)



##########
processing/src/main/java/org/apache/druid/segment/FilteredStorageAdapter.java:
##########
@@ -44,6 +44,24 @@
     this.filterOnDataSource = filter;
   }
 
+  @Override
+  public CursorMaker asCursorMaker(CursorBuildSpec spec)
+  {
+    final CursorBuildSpec.CursorBuildSpecBuilder buildSpecBuilder = 
CursorBuildSpec.builder(spec);
+    final Filter newFilter;
+    if (spec.getFilter() == null) {
+      if (filterOnDataSource != null) {
+        newFilter = filterOnDataSource.toFilter();
+      } else {
+        newFilter = null;
+      }
+    } else {
+      newFilter = new AndFilter(ImmutableList.of(spec.getFilter(), 
filterOnDataSource.toFilter()));

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [filterOnDataSource](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/7438)



##########
processing/src/main/java/org/apache/druid/segment/CursorFactory.java:
##########
@@ -35,12 +38,55 @@
  */
 public interface CursorFactory
 {
+  default CursorMaker asCursorMaker(CursorBuildSpec spec)
+  {
+
+    return new CursorMaker()
+    {
+      @Override
+      public boolean canVectorize()
+      {
+        return CursorFactory.this.canVectorize(spec.getFilter(), 
spec.getVirtualColumns(), spec.isDescending());
+      }
+
+      @Override
+      public Sequence<Cursor> makeCursors()
+      {
+        return CursorFactory.this.makeCursors(
+            spec.getFilter(),
+            spec.getInterval(),
+            spec.getVirtualColumns(),
+            spec.getGranularity(),
+            spec.isDescending(),
+            spec.getQueryMetrics()
+        );
+      }
+
+      @Override
+      public VectorCursor makeVectorCursor()
+      {
+        return CursorFactory.this.makeVectorCursor(
+            spec.getFilter(),
+            spec.getInterval(),
+            spec.getVirtualColumns(),
+            spec.isDescending(),
+            spec.getQueryContext().getVectorSize(),
+            spec.getQueryMetrics()
+        );

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CursorFactory.makeVectorCursor](1) should be avoided because it 
has been deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7433)



##########
processing/src/main/java/org/apache/druid/segment/CursorFactory.java:
##########
@@ -35,12 +38,55 @@
  */
 public interface CursorFactory
 {
+  default CursorMaker asCursorMaker(CursorBuildSpec spec)
+  {
+
+    return new CursorMaker()
+    {
+      @Override
+      public boolean canVectorize()
+      {
+        return CursorFactory.this.canVectorize(spec.getFilter(), 
spec.getVirtualColumns(), spec.isDescending());

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CursorFactory.canVectorize](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7431)



##########
processing/src/main/java/org/apache/druid/segment/QueryableIndexCursorMaker.java:
##########
@@ -668,4 +724,43 @@
       return new DescendingTimestampCheckingOffset(baseOffset.clone(), 
timestamps, timeLimit, allWithinThreshold);
     }
   }
+
+  private final class CursorResources implements Closeable

Review Comment:
   ## Inner class could be static
   
   CursorResources could be made static, since the enclosing instance is used 
only in its constructor.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7436)



-- 
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: commits-unsubscr...@druid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to