This is an automated email from the ASF dual-hosted git repository. hui pushed a commit to branch lmh/fixSelectInto in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit beccd1a3df7d1b1bf5d0fb6033396b089e31a53c Author: liuminghui233 <[email protected]> AuthorDate: Sun May 7 21:09:18 2023 +0800 fix --- .../db/mpp/execution/operator/process/DeviceViewIntoOperator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/DeviceViewIntoOperator.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/DeviceViewIntoOperator.java index 5f2d2022192..32a0959d80f 100644 --- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/DeviceViewIntoOperator.java +++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/DeviceViewIntoOperator.java @@ -49,6 +49,7 @@ public class DeviceViewIntoOperator extends AbstractIntoOperator { private final Map<String, Boolean> targetDeviceToAlignedMap; private final Map<String, List<Pair<String, PartialPath>>> deviceToSourceTargetPathPairListMap; + private final int deviceColumnIndex; private String currentDevice; private final TsBlockBuilder resultTsBlockBuilder; @@ -82,6 +83,9 @@ public class DeviceViewIntoOperator extends AbstractIntoOperator { .map(ColumnHeader::getColumnType) .collect(Collectors.toList()); this.resultTsBlockBuilder = new TsBlockBuilder(outputDataTypes); + + this.deviceColumnIndex = + sourceColumnToInputLocationMap.get(ColumnHeaderConstant.DEVICE).getValueColumnIndex(); } @Override @@ -90,7 +94,7 @@ public class DeviceViewIntoOperator extends AbstractIntoOperator { return true; } - String device = String.valueOf(inputTsBlock.getValueColumns()[0].getBinary(0)); + String device = String.valueOf(inputTsBlock.getValueColumns()[deviceColumnIndex].getBinary(0)); if (!Objects.equals(device, currentDevice)) { InsertMultiTabletsStatement insertMultiTabletsStatement = constructInsertMultiTabletsStatement(false);
