luoluoyuyu opened a new pull request, #18997:
URL: https://github.com/apache/iotdb/pull/18997

   ## Summary
   
   Fixes a silent-success LOAD path for table-model TsFiles whose non-time 
columns were all dropped.
   
   When every FIELD column of a table was removed, compaction could also drop 
the table's `TableSchema`, leaving an empty `TableSchemaMap`. LOAD then treated 
the file as tree-model, converted zero rows, and returned `SUCCESS_STATUS`. 
With `ON_SUCCESS = delete`, the source TsFile was removed even though no data 
was loaded.
   
   ## Root cause
   
   - `CompactionTsFileWriter.removeUnusedTableSchema()` removed every 
`TableSchema` without a `FIELD` column.
   - If all tables were fieldless, the serialized `TableSchemaMap` became empty.
   - Model detection used only `TableSchemaMap` emptiness, so the file was 
classified as tree-model.
   - The fallback converter produced zero rows but still returned success.
   
   ## Changes
   
   - Keep a fieldless `TableSchema` when it has a `TIME` column, or when the 
table actually has data in the target file. Only schemas for tables with no 
FIELD/TIME data and no data in that target are removed, so compaction split 
targets do not claim absent tables.
   - Detect table-model files from the table metadata index and device IDs when 
`TableSchemaMap` is empty (older compaction outputs).
   - Validate table-model schemas during analysis: empty map or any table 
without a `FIELD` column returns `METADATA_ERROR` (507).
   - Prevent the tree/table fallback from reporting success when zero rows were 
converted; return `LOAD_FILE_ERROR` and keep the source file.
   - Preserve the first-stage failure reason when fallback conversion also 
fails.
   - Add i18n messages (en/zh) and UT coverage for analyzer validation, 
compaction schema retention, and the zero-row guard.
   
   ## Testing
   
   - Targeted tests: 26 passed (`CompactionTestFileWriterTest`, 
`TableModelFastCompactionPerformerTest`, 
`TableModelReadPointCompactionPerformerTest`, `LoadTsFileAnalyzerTest`).
   - `mvn test-compile -DskipTests` (en): passed.
   - `mvn test-compile -DskipTests -P with-zh-locale`: passed.
   - `mvn spotless:apply`: passed.
   


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

Reply via email to