Caideyipi commented on code in PR #18824:
URL: https://github.com/apache/iotdb/pull/18824#discussion_r4244720323
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/TableSessionWrapper.java:
##########
@@ -68,6 +77,64 @@ public void insert(Tablet tablet) throws
StatementExecutionException, IoTDBConne
}
}
+ @Override
+ public NumericRowPreparedStatement prepareInsertNumericRow(
+ String tableName,
+ List<String> columnNames,
+ List<TSDataType> dataTypes,
+ List<ColumnCategory> columnCategories)
+ throws StatementExecutionException, IoTDBConnectionException {
+ checkOpen();
+ try {
+ return tableSession.prepareInsertNumericRow(
+ tableName, columnNames, dataTypes, columnCategories);
+ } catch (IoTDBConnectionException e) {
+ invalidateSession();
+ throw e;
+ }
+ }
+
+ @Override
+ public void executePreparedInsertNumericRow(
+ NumericRowPreparedStatement prepared, long timestamp, long[] values,
String[] tagValues)
+ throws StatementExecutionException, IoTDBConnectionException {
+ executePreparedInsertNumericRow(prepared, timestamp, values, tagValues,
null);
+ }
+
+ @Override
+ public void executePreparedInsertNumericRow(
+ NumericRowPreparedStatement prepared,
+ long timestamp,
+ long[] values,
+ String[] tagValues,
+ BitMap nullBitmap)
+ throws StatementExecutionException, IoTDBConnectionException {
+ checkOpen();
+ try {
+ tableSession.executePreparedInsertNumericRow(
+ prepared, timestamp, values, tagValues, nullBitmap);
+ } catch (IoTDBConnectionException e) {
+ invalidateSession();
+ throw e;
Review Comment:
**[P2] Keep local handle errors from discarding a healthy pooled session**
`TableSession.executePreparedInsertNumericRow` throws
`IoTDBConnectionException` for a closed or foreign prepared handle before
sending any RPC. This catch treats that local validation error as a broken
transport and permanently closes the wrapper. I reproduced `prepare ->
prepared.close() -> execute(closed)` followed by a replacement prepare: the
replacement fails with `Table session is closed`, although the RPC client never
received an execute request. Stale handles have the same problem.
Please distinguish invalid-handle errors from transport failures so callers
can prepare a replacement on the healthy borrowed session.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipePlanToStatementVisitor.java:
##########
@@ -84,6 +86,19 @@ public Statement visitPlan(final PlanNode node, final Void
context) {
node));
}
+ @Override
+ public InsertNumericRowStatement visitRelationalInsertNumericRow(
+ final RelationalInsertNumericRowNode node, final Void context) {
+ InsertNumericRowStatement statement = new InsertNumericRowStatement();
+ statement.setDevicePath(node.getTargetPath());
+ statement.setTime(node.getTime());
+ statement.setMeasurements(node.getMeasurements());
+ statement.setDataTypes(node.getDataTypes());
+ statement.setNumericValues(node.getNumericValues());
+ statement.setColumnCategories(node.getColumnCategories());
Review Comment:
**[P1] Copy numeric event data before writeback schema validation**
This statement aliases the source node's measurement/type arrays and
`NumericRowValues`. The writeback sink uses this visitor without
serializing/copying the node, while shallow copies of
`PipeInsertNodeTabletInsertionEvent` share the same `InsertNode` across pipes.
If the writeback destination has an incompatible FIELD with partial inserts
enabled, `markFailedMeasurement` nulls the shared measurement/type and clears
its raw value. In a focused repro, validating source `INT64 v=2` against a
BOOLEAN destination changed the source event to `measurements=[tag, null]` and
`values=[0]`. Another pipe can then lose the valid source FIELD.
Please copy the mutable metadata and primitive values/null bits at this
boundary so destination casting or failure handling cannot change the source
event.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/payload/evolvable/request/PipeTransferTabletBatchReqV2.java:
##########
@@ -78,9 +79,12 @@ public List<InsertBaseStatement> constructStatements() {
continue;
}
if (statement.isWriteToTable()) {
- if (statement instanceof InsertRowStatement) {
- addTableModelInsertRowStatement(
- tableModelDatabaseInsertRowStatementMap, (InsertRowStatement)
statement);
+ if (statement instanceof InsertNumericRowStatement) {
+ // Keep numeric rows independent: grouping into InsertRowsStatement
would box their
+ // values.
+ statements.add(statement);
Review Comment:
**[P1] Preserve row order when a batch mixes numeric and ordinary rows**
Numeric statements are appended immediately, while ordinary row statements
are retained in `tableModelDatabaseInsertRowStatementMap` and appended only
after the loop. For the same table/device/timestamp, an ordinary row with `v=1`
followed by a prepared numeric row with `v=2` is therefore executed as `[2,
1]`. I reproduced this through the V2 batch serializer/deserializer and
MemTable/TsBlock readback: the source returns `2`, but the receiver returns `1`.
Please preserve the original order, for example by flushing accumulated row
runs before appending a numeric row, while retaining primitive numeric storage,
and add a mixed-row overwrite regression.
--
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]