CritasWang commented on PR #18987:
URL: https://github.com/apache/iotdb/pull/18987#issuecomment-6337810819

   ## Test cases and results
   
   All testing targets the latest commit on this PR (`54ccbbf7c9`, after the 
Sonar and review fixes).
   
   ### Unit tests — `iotdb-client/cli`
   
   80 tests pass (75 on the previous commit, +5 new).
   
   New cases in `DataToolRegressionTest`:
   - **`testTableQueriesCannotWriteComputedValuesBack`** — aliases, arithmetic, 
functions and `FILL` in `-q` are rejected before any query runs, for both `sql` 
and `tsfile`. Verified with five SQL variants, each for both formats.
   - **`testTableQuerySelectingColumnsIsExported`** — a query selecting column 
names (no alias) with a `WHERE`, `ORDER BY` and `LIMIT` exports correctly.
   - **`testTableQueriesNeedAFieldColumnBeforeAnyQueryRuns`** — two queries 
where the second selects only `time` and a TAG: all queries are rejected before 
the first runs, no file is written.
   - **`testTableQueryColumnsAreCheckedAgainstTheTable`** — missing the `time` 
column, selecting a column twice or naming a non-existent column all produce 
the `invalidColumns` error; selecting only `time + device_id` in a TsFile 
export produces the missing-TAG error.
   - **`testExportChecksTheColumnsTheQueryReturns`** — the table changes 
between planning and the query: the returned columns are re-checked at export 
time.
   
   Regression tests that already covered related paths now also exercise:
   - `explain select *`, CTEs, subqueries, set operations and column aliases 
(`select * from t as a(time, w)`) as invalid `-q` input.
   
   ### Integration tests — `ExportDataMeasurementIT`, `ExportDataTestIT`
   
   `originalQueryAndTableModesAndFailures` now asserts that for each of `sql` 
and `tsfile`, a query with a computed alias and a query without a FIELD column 
both exit non-zero and write no output file. 4 passes (2 new assertions 
exercised), 1 skipped (benchmark).
   
   ### Manual matrix — large data (1 M rows per device, `iotdb-export-review` 
container)
   
   18 cases run with the new jar, all pass. The 11 cases that were already in 
the matrix at the time of the previous test run are re-checked; 7 new cases 
cover the review findings.
   
   | Case | Combination | Exit | Files | Rows | Result |
   |---|---|---|---|---|---|
   | B02 | whole-db sql + time range | 0 | 182 | 1,814,400 | PASS |
   | B03 | whole-db tsfile + time range | 0 | 2 | 1,814,400 | PASS |
   | B05 | `-table` sql | 0 | 200 | 2,000,000 | PASS |
   | B06 | `-table` tsfile | 0 | 1 | 2,000,000 | PASS |
   | B07 | `-q` csv (reference for B25) | 0 | 100 | 1,000,000 | PASS |
   | B08 | `-q` sql, table from query | 0 | 100 | 1,000,000 | PASS |
   | B09 | `-q` tsfile, table from query | 0 | 1 | 1,000,000 | PASS |
   | B12 | `-q` sql + ignored `-table`, WARNING | 0 | 100 | 1,000,000 | PASS |
   | B17 | ~~join~~ rejected before any query runs | 1 | 0 | 0 | PASS |
   | B18 | ~~cross-db second query~~ both rejected, no file written | 1 | 0 | 0 
| PASS |
   | B19 | two `-q` sql, each written to its own table | 0 | 200 | 2,000,000 | 
PASS |
   | **B20** | `temperature + 1 as temperature` → **rejected** (computed alias) 
| 1 | 0 | 0 | PASS |
   | **B21** | same computed alias, tsfile → **rejected** | 1 | 0 | 0 | PASS |
   | **B22** | `select time, device_id` (no FIELD) → **rejected** | 1 | 0 | 0 | 
PASS |
   | **B23** | `... fill method previous` → **rejected** (FILL) | 1 | 0 | 0 | 
PASS |
   | **B24** | `select time, temperature` without TAG column, tsfile → 
**rejected** | 1 | 0 | 0 | PASS |
   | **B25** | `select time, device_id, temperature from readings where 
device_id = 'd1'` sql | 0 | 100 | 1,000,000 | PASS |
   | **B26** | same query, tsfile | 0 | 1 | 1,000,000 | PASS |
   
   Error messages for the rejected cases:
   - B20, B21, B23: `SQL/TsFile export can only select * or column names, 
without FILL.`
   - B22: `SQL/TsFile output requires a FIELD column from table readings.`
   - B24: `TsFile output requires every TAG column from table readings.`
   
   **Value-level verification** — `VerifyExports.java` checked every value in 
the 11 re-run positive cases against the data generation formula: 886 files, 
13,628,800 rows, 39,886,400 values, 0 mismatches.
   
   **B25 vs B07 comparison** — `compare_b25_b07.py` compared all 1,000,000 rows 
of B25 (column-name projection SQL) with B07 (CSV of the same query, 
independently verified): 0 mismatches.
   
   **TsFile point counts** — `TsFileCount.java` checked every B03/B06/B09/B26 
TsFile against the expected point count and time range: 8 entries, 0 mismatches.
   
   **SQL reimport** — first and last file of B02, B05, B08, B12, B19 and B25 
reimported with `import-data.sh`: all 12 files `Import completely!`, 0 failure 
records.
   
   ### Sonar
   
   The quality gate fails on `new_reliability_rating` (C), but the single BUG 
(`DataNodeTableCache.java:426`, NPE) is in code introduced by `#18874`, not 
this PR. The master Sonar job has been failing (OOM) or cancelled for every 
push since before this PR was opened, so `master` is stale as a new-code 
baseline for all PR analyses. The 5 checkstyle `LineLengthCheck` violations 
that were on this PR's own lines (`OptionsUtil.java:249–302`) are fixed in 
`54ccbbf7c9`; this PR's changes reduce the total checkstyle violation count 
from 165 to 155.
   


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