Caideyipi commented on code in PR #18828:
URL: https://github.com/apache/iotdb/pull/18828#discussion_r4344294769
##########
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportDataTable.java:
##########
@@ -370,36 +383,39 @@ protected void writeData(
}
private static void writeAndEmptyDataSet(Tablet tablet, int retryTime) {
- try (ITableSession session = sessionPool.getSession()) {
- session.insert(tablet);
- } catch (IoTDBConnectionException e) {
- if (retryTime > 0) {
- writeAndEmptyDataSet(tablet, --retryTime);
- }
- } catch (StatementExecutionException e) {
- ioTPrinter.println(Constants.INSERT_CSV_MEET_ERROR_MSG + e.getMessage());
- System.exit(1);
- }
+ executeWithRetry(
+ () -> {
+ try (ITableSession session = sessionPool.getSession()) {
+ session.insert(tablet);
+ }
+ },
+ retryTime);
}
private void parseHeaders(
List<String> headerNames,
Map<String, TSDataType> headerTypeMap,
Map<String, String> headerNameMap) {
- String regex = "(?<=\\()\\S+(?=\\))";
+ String regex = "\\(([^()]+)\\)$";
Pattern pattern = Pattern.compile(regex);
for (String headerName : headerNames) {
- headerName = headerName.toLowerCase();
+ String normalizedHeaderName = headerName.toLowerCase(Locale.ROOT);
+ // A complete table column name takes precedence over a possible type
suffix.
+ if (dataTypes.containsKey(normalizedHeaderName)) {
Review Comment:
Applied in `0ccd98be35fc9832c196fb38eea2accae6a3065b`.
Header resolution now runs in two passes: exact column names first, then
trailing type annotations for unmatched headers. Duplicate target columns
reject the whole file before any insert, call `markFileFailed()`, emit an
English/Chinese diagnostic, and do not increment the success count.
Added export/import regressions for both column orders: the typed
`value`/`value(double)` case fails explicitly, while the untyped case preserves
both values. Existing single-column round trips still pass.
All 43 targeted CLI tests pass in both English and Chinese; Spotless and
Checkstyle pass. Full-reactor `test-compile -DskipTests` also passed in both
English and Chinese locales (53/53 modules each).
Leaving this thread open for re-review.
--
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]