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


##########
processing/src/main/java/org/apache/druid/query/metadata/metadata/ColumnAnalysis.java:
##########
@@ -182,17 +192,15 @@
       newMin = NullHandling.nullToEmptyIfNeeded((String) newMin);
       newMax = NullHandling.nullToEmptyIfNeeded((String) newMax);
     }
-    return new ColumnAnalysis(
-        typeSignature,
-        type,
-        multipleValues,
-        hasNulls || rhs.hasNulls,
-        size + rhs.getSize(),
-        cardinality,
-        newMin,
-        newMax,
-        null
-    );
+    return builder().withType(typeSignature)
+                    .withTypeName(type)
+                    .hasMultipleValues(multipleValues)
+                    .hasNulls(hasNulls || rhs.hasNulls)
+                    .withSize(size + rhs.getSize())

Review Comment:
   ## User-controlled data in arithmetic expression
   
   This arithmetic expression depends on a [user-provided value](1), 
potentially causing an overflow.
   This arithmetic expression depends on a [user-provided value](2), 
potentially causing an overflow.
   This arithmetic expression depends on a [user-provided value](3), 
potentially causing an overflow.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/4969)



##########
processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java:
##########
@@ -344,67 +336,51 @@
     final TypeSignature<ValueType> typeSignature = capabilities == null ? 
ColumnType.UNKNOWN_COMPLEX : capabilities;
     final String typeName = typeSignature.getComplexTypeName();
 
+    final ColumnAnalysis.Builder bob = ColumnAnalysis.builder()
+                                                     
.withType(ColumnTypeFactory.ofType(typeSignature))
+                                                     .withTypeName(typeName);
+
     try (final BaseColumn theColumn = columnHolder != null ? 
columnHolder.getColumn() : null) {
+      if (theColumn != null && !(theColumn instanceof ComplexColumn)) {
+        return bob.withErrorMessage(
+                    StringUtils.format(
+                        "[%s] is not a [%s]",
+                        theColumn == null ? null : 
theColumn.getClass().getName(),

Review Comment:
   ## Useless null check
   
   This check is useless. [theColumn](1) cannot be null at this check, since it 
is guarded by [... != ...](2).
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/4968)



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