hello-stephen commented on code in PR #71199:
URL: https://github.com/apache/doris/pull/71199#discussion_r4752819517


##########
fe/fe-core/src/test/java/org/apache/doris/catalog/stream/CloudTableStreamConsumptionTest.java:
##########
@@ -202,12 +219,43 @@ public void 
testConsumptionViewReadsAuthoritativeCloudOffsets() throws Exception
             Assertions.assertEquals("100", 
rows.get(0).getColumnValue().get(4).getStringVal());
             Assertions.assertEquals("30", 
rows.get(0).getColumnValue().get(5).getStringVal());
             Assertions.assertEquals(999, 
rows.get(0).getColumnValue().get(6).getLongVal());
+            Assertions.assertEquals(7, rows.get(0).getColumnValue().size());
 
-            result = 
MetadataGenerator.getSchemaTableData(newStreamIdConsumptionRequest(secondStream.getId()));
+            // Request with columns_name returns the extended monitoring 
columns as well.
+            TFetchSchemaTableDataRequest monitoringRequest = 
newConsumptionRequest("test_cloud_stream_consumption", "s1");
+            monitoringRequest.getSchemaTableParams().setColumnsName(List.of(
+                    "DB_NAME", "STREAM_NAME", "STREAM_ID", "UNIT", 
"CONSUMPTION_STATUS", "LAG",
+                    "LAST_CONSUMPTION_TIME", "PENDING_AGE_SECONDS", 
"CAN_RESUME", "UNRESUMABLE_REASON"));
+            TFetchSchemaTableDataResult monitoringResult = 
MetadataGenerator.getSchemaTableData(monitoringRequest);
+            Assertions.assertEquals(TStatusCode.OK, 
monitoringResult.getStatus().getStatusCode());
+            Assertions.assertEquals(1, monitoringResult.getDataBatchSize());
+            TRow monitoringRow = monitoringResult.getDataBatch().get(0);
+            Assertions.assertEquals(10, monitoringRow.getColumnValue().size());
+            // Cold lag without prior monitor snapshot reports unknown 
sentinel (-1.0).
+            Assertions.assertEquals(-1.0, 
monitoringRow.getColumnValue().get(7).getDoubleVal(), 1e-6);
+            // Synthetic offsetTso=100 predates the default 1-day 
changelog.ttl_seconds cutoff.
+            Assertions.assertEquals(0, 
monitoringRow.getColumnValue().get(8).getIntVal());
+            Assertions.assertEquals("TTL_EXPIRED", 
monitoringRow.getColumnValue().get(9).getStringVal());
+
+            TFetchSchemaTableDataRequest s2Request = 
newStreamIdConsumptionRequest(secondStream.getId());
+            s2Request.getSchemaTableParams().setColumnsName(List.of(
+                    "DB_NAME", "STREAM_NAME", "STREAM_ID", "UNIT", 
"CONSUMPTION_STATUS", "LAG",
+                    "LAST_CONSUMPTION_TIME", "PENDING_AGE_SECONDS", 
"CAN_RESUME", "UNRESUMABLE_REASON"));
+            result = MetadataGenerator.getSchemaTableData(s2Request);
             Assertions.assertEquals(TStatusCode.OK, 
result.getStatus().getStatusCode());
             Assertions.assertEquals(2, result.getDataBatchSize());
-            Assertions.assertTrue(result.getDataBatch().stream()
+            List<TRow> s2Rows = new ArrayList<>(result.getDataBatch());
+            s2Rows.sort(Comparator.comparing(row -> 
row.getColumnValue().get(3).getStringVal()));
+            Assertions.assertTrue(s2Rows.stream()
                     .allMatch(row -> row.getColumnValue().get(2).getLongVal() 
== secondStream.getId()));
+            // p1 is INITIAL_SNAPSHOT_PENDING with a 15s-old real TSO -> 
strictly positive pending age, RESUMABLE.
+            
Assertions.assertTrue(s2Rows.get(0).getColumnValue().get(7).getDoubleVal() > 
0.0);
+            Assertions.assertEquals(1, 
s2Rows.get(0).getColumnValue().get(8).getIntVal());

Review Comment:
   [P2] Read CAN_RESUME from the Thrift long field
   
   `CAN_RESUME` is BIGINT and `CloudStreamConsumptionSnapshot.fillRows()` sets 
only `TCell.longVal`. This assertion and the p2 assertion below read the 
separate, unset `intVal`, so both get 0 and fail despite the correct resumable 
result of 1. Use `getLongVal()` in all three new CAN_RESUME assertions; the 
expected-zero assertion above currently passes without checking the emitted 
value.



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