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


##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/NestedDataFormatsTest.java:
##########
@@ -96,12 +95,23 @@
     cluster.callApi().runTask(indexTask.withId(taskId), overlord);
     cluster.callApi().waitForAllSegmentsToBeAvailable(dataSource, coordinator, 
broker);
 
-    // Test ingesting with skipping raw json smile format works, same row 
count, with ~20% storage saving
-    final String metadataSql = "select sum(num_rows), sum(size) from 
sys.segments where datasource = '%s'";
-    final String defaultFormatResult = cluster.runSql(metadataSql, 
datasourceWithDefaultFormat);
-    final String noneObjectStorageFormatResult = cluster.runSql(metadataSql, 
dataSource);
-    Assertions.assertEquals(StringUtils.format("%d,%d", 465_346, 53_000_804), 
defaultFormatResult);
-    Assertions.assertEquals(StringUtils.format("%d,%d", 465_346, 41_938_750), 
noneObjectStorageFormatResult);
+    // Test ingesting with skipping raw json smile format works, with the same 
row count
+    final String rowsSql = "select sum(num_rows) from sys.segments where 
datasource = '%s'";
+    final String defaultFormatRows = cluster.runSql(rowsSql, 
datasourceWithDefaultFormat);
+    final String noneObjectStorageFormatRows = cluster.runSql(rowsSql, 
dataSource);
+    Assertions.assertEquals(String.valueOf(465_346), defaultFormatRows);
+    Assertions.assertEquals(String.valueOf(465_346), 
noneObjectStorageFormatRows);
+
+    // Test ingesting with skipping raw json smile format works, with ~20% 
storage saving
+    final String metadataSql = "select sum(size) from sys.segments where 
datasource = '%s'";
+    final String defaultFormatSize = cluster.runSql(metadataSql, 
datasourceWithDefaultFormat);
+    final String noneObjectStorageFormatSize = cluster.runSql(metadataSql, 
dataSource);
+    System.out.println(noneObjectStorageFormatSize);
+    System.out.println(defaultFormatSize);
+    Assertions.assertTrue(
+        Integer.parseInt(noneObjectStorageFormatSize) <= 
Integer.parseInt(defaultFormatSize) * 0.8,

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10585)



##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/NestedDataFormatsTest.java:
##########
@@ -96,12 +95,23 @@
     cluster.callApi().runTask(indexTask.withId(taskId), overlord);
     cluster.callApi().waitForAllSegmentsToBeAvailable(dataSource, coordinator, 
broker);
 
-    // Test ingesting with skipping raw json smile format works, same row 
count, with ~20% storage saving
-    final String metadataSql = "select sum(num_rows), sum(size) from 
sys.segments where datasource = '%s'";
-    final String defaultFormatResult = cluster.runSql(metadataSql, 
datasourceWithDefaultFormat);
-    final String noneObjectStorageFormatResult = cluster.runSql(metadataSql, 
dataSource);
-    Assertions.assertEquals(StringUtils.format("%d,%d", 465_346, 53_000_804), 
defaultFormatResult);
-    Assertions.assertEquals(StringUtils.format("%d,%d", 465_346, 41_938_750), 
noneObjectStorageFormatResult);
+    // Test ingesting with skipping raw json smile format works, with the same 
row count
+    final String rowsSql = "select sum(num_rows) from sys.segments where 
datasource = '%s'";
+    final String defaultFormatRows = cluster.runSql(rowsSql, 
datasourceWithDefaultFormat);
+    final String noneObjectStorageFormatRows = cluster.runSql(rowsSql, 
dataSource);
+    Assertions.assertEquals(String.valueOf(465_346), defaultFormatRows);
+    Assertions.assertEquals(String.valueOf(465_346), 
noneObjectStorageFormatRows);
+
+    // Test ingesting with skipping raw json smile format works, with ~20% 
storage saving
+    final String metadataSql = "select sum(size) from sys.segments where 
datasource = '%s'";
+    final String defaultFormatSize = cluster.runSql(metadataSql, 
datasourceWithDefaultFormat);
+    final String noneObjectStorageFormatSize = cluster.runSql(metadataSql, 
dataSource);
+    System.out.println(noneObjectStorageFormatSize);
+    System.out.println(defaultFormatSize);
+    Assertions.assertTrue(
+        Integer.parseInt(noneObjectStorageFormatSize) <= 
Integer.parseInt(defaultFormatSize) * 0.8,

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10584)



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