shuwenwei opened a new pull request, #18408: URL: https://github.com/apache/iotdb/pull/18408
## Problem For `COPY TO` (table model, TsFile format), `TAGS(device, device)` was **silently deduplicated** to `[device]`: the identifiers are added to a `LinkedHashSet` in `AstBuilder.addCopyToOption`, so the duplicate info is lost before `CopyToTsFileOptions.check()` runs. No error was reported, and a file was generated with fewer tag columns than the user specified (e.g. a 2,088-byte file instead of an error). Duplicate option clauses are also silently swallowed: `(tags(a), tags(b))` / `(time x, time y)` etc. let the last value win because the `CopyToOptions.Builder` setters simply overwrite. ## Fix Reject both at parse time in `AstBuilder`: - Duplicate tag columns inside a `TAGS(...)` clause → `Duplicate tag column in TAGS clause: %s` - A repeated option key (FORMAT/TABLE/TIME/TAGS/MEMORY_THRESHOLD) → `Duplicate option in COPY TO statement: %s` Both messages use new i18n constants (en + zh) in `DataNodeQueryMessages`. Note: duplicate columns in the table column list (`copy table1(time, time, s1)`) already error via `DUPLICATE_COLUMN_NAMES_IN_QUERY_DATASET` in `CopyToTsFileOptions.check()` because they travel as a list, not a set — unchanged. ## Tests Added to `IoTDBCopyToTsFileIT`: - `testDuplicateTagColumns` — `tags(tag1, tag1)` must report the duplicate tag column error - `testDuplicateOption` — `tags(tag1), tags(tag2)` must report the duplicate option error -- 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]
