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


##########
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:
##########
@@ -982,13 +983,40 @@
               mismatchMessage(row, column),
               (Float) expectedCell,
               (Float) resultCell,
-              ASSERTION_EPSILON);
+              ASSERTION_EPSILON
+          );
         } else if (expectedCell instanceof Double) {
           assertEquals(
               mismatchMessage(row, column),
               (Double) expectedCell,
               (Double) resultCell,
-              ASSERTION_EPSILON);
+              ASSERTION_EPSILON
+          );
+        } else if (expectedCell instanceof Object[] || expectedCell instanceof 
List) {
+          final Object[] expectedCellCasted;
+          if (expectedCell instanceof Object[]) {
+            expectedCellCasted = (Object[]) expectedCell;
+          } else {
+            expectedCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          }
+          final Object[] resultCellCasted;
+          if (resultCell instanceof List) {
+            resultCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          } else {
+            resultCellCasted = (Object[]) resultCell;
+          }
+          if (expectedCellCasted.length != resultCellCasted.length) {
+            throw new RE(
+                "Mismatched array lengths: expected[%s] with length[%d], 
actual[%s] with length[%d]",
+                expectedCellCasted,

Review Comment:
   ## Implicit conversion from array to string
   
   Implicit conversion from Array to String.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7812)



##########
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:
##########
@@ -982,13 +983,40 @@
               mismatchMessage(row, column),
               (Float) expectedCell,
               (Float) resultCell,
-              ASSERTION_EPSILON);
+              ASSERTION_EPSILON
+          );
         } else if (expectedCell instanceof Double) {
           assertEquals(
               mismatchMessage(row, column),
               (Double) expectedCell,
               (Double) resultCell,
-              ASSERTION_EPSILON);
+              ASSERTION_EPSILON
+          );
+        } else if (expectedCell instanceof Object[] || expectedCell instanceof 
List) {
+          final Object[] expectedCellCasted;
+          if (expectedCell instanceof Object[]) {
+            expectedCellCasted = (Object[]) expectedCell;
+          } else {
+            expectedCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          }
+          final Object[] resultCellCasted;
+          if (resultCell instanceof List) {
+            resultCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          } else {
+            resultCellCasted = (Object[]) resultCell;
+          }
+          if (expectedCellCasted.length != resultCellCasted.length) {
+            throw new RE(
+                "Mismatched array lengths: expected[%s] with length[%d], 
actual[%s] with length[%d]",
+                expectedCellCasted,
+                expectedCellCasted.length,
+                resultCellCasted,

Review Comment:
   ## Implicit conversion from array to string
   
   Implicit conversion from Array to String.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7813)



##########
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:
##########
@@ -1019,6 +1047,31 @@
               (Double) resultCell,
               eps
           );
+        } else if (expectedCell instanceof Object[] || expectedCell instanceof 
List) {
+          final Object[] expectedCellCasted;
+          if (expectedCell instanceof Object[]) {
+            expectedCellCasted = (Object[]) expectedCell;
+          } else {
+            expectedCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          }
+          final Object[] resultCellCasted;
+          if (resultCell instanceof List) {
+            resultCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          } else {
+            resultCellCasted = (Object[]) resultCell;
+          }
+          if (expectedCellCasted.length != resultCellCasted.length) {
+            throw new RE(
+                "Mismatched array lengths: expected[%s] with length[%d], 
actual[%s] with length[%d]",
+                expectedCellCasted,
+                expectedCellCasted.length,
+                resultCellCasted,

Review Comment:
   ## Implicit conversion from array to string
   
   Implicit conversion from Array to String.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7815)



##########
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:
##########
@@ -1019,6 +1047,31 @@
               (Double) resultCell,
               eps
           );
+        } else if (expectedCell instanceof Object[] || expectedCell instanceof 
List) {
+          final Object[] expectedCellCasted;
+          if (expectedCell instanceof Object[]) {
+            expectedCellCasted = (Object[]) expectedCell;
+          } else {
+            expectedCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          }
+          final Object[] resultCellCasted;
+          if (resultCell instanceof List) {
+            resultCellCasted = ExprEval.coerceListToArray((List) resultCell, 
true).rhs;
+          } else {
+            resultCellCasted = (Object[]) resultCell;
+          }
+          if (expectedCellCasted.length != resultCellCasted.length) {
+            throw new RE(
+                "Mismatched array lengths: expected[%s] with length[%d], 
actual[%s] with length[%d]",
+                expectedCellCasted,

Review Comment:
   ## Implicit conversion from array to string
   
   Implicit conversion from Array to String.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7814)



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