This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.13 by this push:
new 344605cbbc [To rel/0.13][IOTDB-2864] Fix Read-only occurred when
insert Text values to aligned timeseries (#5461)
344605cbbc is described below
commit 344605cbbcf1fdc2b3ecea22ff3386d205c1403b
Author: Haonan <[email protected]>
AuthorDate: Sat Apr 9 12:13:14 2022 +0800
[To rel/0.13][IOTDB-2864] Fix Read-only occurred when insert Text values to
aligned timeseries (#5461)
---
...aluesIT.java => IoTDBInsertAlignedValuesIT.java} | 21 ++++++++++++++++++++-
.../iotdb/db/utils/datastructure/AlignedTVList.java | 12 ++++++++++--
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git
a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java
b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
similarity index 92%
rename from
integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java
rename to
integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
index d8b3363368..14beb4ae47 100644
---
a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java
+++
b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
@@ -40,7 +40,7 @@ import java.sql.Statement;
import java.util.Objects;
@Category({LocalStandaloneTest.class})
-public class IOTDBInsertAlignedValuesIT {
+public class IoTDBInsertAlignedValuesIT {
private static Connection connection;
private static final int oldTsFileGroupSizeInByte =
TSFileDescriptor.getInstance().getConfig().getGroupSizeInByte();
@@ -369,4 +369,23 @@ public class IOTDBInsertAlignedValuesIT {
Assert.assertEquals("411: Insertion contains duplicated measurement:
status", e.getMessage());
}
}
+
+ @Test
+ public void testExtendTextColumn() {
+ int primitiveArraySize =
IoTDBDescriptor.getInstance().getConfig().getPrimitiveArraySize();
+ IoTDBDescriptor.getInstance().getConfig().setPrimitiveArraySize(2);
+ try (Statement st1 = connection.createStatement()) {
+ st1.execute("insert into root.sg.d1(time,s1,s2) aligned
values(1,'test','test')");
+ st1.execute("insert into root.sg.d1(time,s1,s2) aligned
values(2,'test','test')");
+ st1.execute("insert into root.sg.d1(time,s1,s2) aligned
values(3,'test','test')");
+ st1.execute("insert into root.sg.d1(time,s1,s2) aligned
values(4,'test','test')");
+ st1.execute("insert into root.sg.d1(time,s1,s3) aligned
values(5,'test','test')");
+ st1.execute("insert into root.sg.d1(time,s1,s2) aligned
values(6,'test','test')");
+ st1.execute("flush");
+ st1.execute("insert into root.sg.d1(time,s1,s3) aligned
values(7,'test','test')");
+ } catch (SQLException e) {
+ Assert.fail();
+ }
+
IoTDBDescriptor.getInstance().getConfig().setPrimitiveArraySize(primitiveArraySize);
+ }
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
index c91348fce5..929d459cdf 100644
---
a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
+++
b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
@@ -298,8 +298,16 @@ public class AlignedTVList extends TVList {
break;
}
BitMap bitMap = new BitMap(ARRAY_SIZE);
- // last bitmap should be marked to the tslist size's position
- if (i == timestamps.size() - 1) {
+ // The following code is for these 2 kinds of scenarios.
+
+ // Eg1: If rowCount=5 and ARRAY_SIZE=2, we need to supply 3 bitmaps for
the extending column.
+ // The first 2 bitmaps should mark all bits to represent 4 nulls and the
3rd bitmap should
+ // mark
+ // the 1st bit to represent 1 null value.
+
+ // Eg2: If rowCount=4 and ARRAY_SIZE=2, we need to supply 2 bitmaps for
the extending column.
+ // These 2 bitmaps should mark all bits to represent 4 nulls.
+ if (i == timestamps.size() - 1 && rowCount % ARRAY_SIZE != 0) {
for (int j = 0; j < rowCount % ARRAY_SIZE; j++) {
bitMap.mark(j);
}