airborne12 commented on code in PR #65776:
URL: https://github.com/apache/doris/pull/65776#discussion_r3627008129


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletStorageFormatCommand.java:
##########
@@ -89,26 +92,46 @@ public ShowResultSet doRun(ConnectContext ctx, StmtExecutor 
executor) throws Exc
                 if (result == null) {
                     throw new AnalysisException("get tablet data from backend: 
" + be.getId() + "error.");
                 }
+                List<Long> invertedIndexV1Tablets = 
result.isSetInvertedIndexV1Tablets()
+                        ? result.getInvertedIndexV1Tablets() : 
Lists.newArrayList();
+                List<Long> invertedIndexV2Tablets = 
result.isSetInvertedIndexV2Tablets()
+                        ? result.getInvertedIndexV2Tablets() : 
Lists.newArrayList();
+                List<Long> invertedIndexV3Tablets = 
result.isSetInvertedIndexV3Tablets()
+                        ? result.getInvertedIndexV3Tablets() : 
Lists.newArrayList();
                 if (verbose) {
+                    Map<Long, String> storageFormats = new HashMap<>();
                     for (long tabletId : result.getV1Tablets()) {

Review Comment:
   [Blocking] Please preserve the distinction between an unset optional field 
and a known-empty list.
   
   After this PR enables the command in cloud mode, a new FE can call an old 
Cloud BE whose `BaseBackendService::check_storage_format()` returns a non-null 
result with `v1_tablets` and `v2_tablets` unset. Thrift getters return `null` 
here, so this loop and the summary `.size()` calls throw `NullPointerException`.
   
   An old local BE sets `v1_tablets`/`v2_tablets` but does not know the new 
inverted-index fields. Converting those absent fields to empty lists also makes 
the non-verbose result report `0`, although the format count is unknown.
   
   Please guard all optional lists with `isSet...`, retain whether the 
inverted-index fields were present, and return `UNKNOWN` or a clear 
unsupported-version error for absent data. Please also add mixed-version tests 
for both response shapes: old local BE (only v1/v2 set) and old Cloud BE (all 
lists unset).



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