This is an automated email from the ASF dual-hosted git repository. rong pushed a commit to branch iotdb-2346 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 332187eeeb09c24958262e4bf28fde836ed5a148 Author: Steve Yurong Su <[email protected]> AuthorDate: Tue Jan 11 13:38:31 2022 +0800 [IOTDB-2346] Select INTO Reports NPE for time series containing binary values of NULL --- .../java/org/apache/iotdb/db/integration/IoTDBSelectIntoIT.java | 8 ++++++-- .../iotdb/db/engine/selectinto/InsertTabletPlanGenerator.java | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSelectIntoIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSelectIntoIT.java index a8febac..b455035 100644 --- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSelectIntoIT.java +++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSelectIntoIT.java @@ -59,6 +59,8 @@ public class IoTDBSelectIntoIT { "insert into root.sg.d1(time, s1, s2, s4, s5, s6) values (2, 2, 2, 2, true, '2')", "insert into root.sg.d1(time, s1, s2, s3, s5, s6) values (3, 3, 3, 3, false, '3')", "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6) values (4, 4, 4, 4, 4, true, '4')", + "insert into root.sg.d1(time, s1, s2, s3, s4, s6) values (5, 5, 5, 5, 5, '5')", + "insert into root.sg.d1(time, s1, s2, s3, s4, s5) values (6, 6, 6, 6, 6, true)", }; @BeforeClass @@ -426,7 +428,7 @@ public class IoTDBSelectIntoIT { try (ResultSet resultSet = statement.executeQuery("select count_s1 from root.sg.d1")) { assertEquals(1 + 1, resultSet.getMetaData().getColumnCount()); - for (int i = 1; i < INSERTION_SQLS.length; ++i) { + for (int i = 1; i < INSERTION_SQLS.length - 2; ++i) { assertTrue(resultSet.next()); for (int j = 0; j < 1 + 1; ++j) { assertEquals(String.valueOf(i), resultSet.getString(1)); @@ -461,6 +463,8 @@ public class IoTDBSelectIntoIT { } } + assertTrue(resultSet.next()); + assertTrue(resultSet.next()); assertFalse(resultSet.next()); } } catch (SQLException throwable) { @@ -482,7 +486,7 @@ public class IoTDBSelectIntoIT { assertTrue(resultSet.next()); assertEquals("10", resultSet.getString(1)); - assertEquals("4", resultSet.getString(2)); + assertEquals("6", resultSet.getString(2)); assertFalse(resultSet.next()); } diff --git a/server/src/main/java/org/apache/iotdb/db/engine/selectinto/InsertTabletPlanGenerator.java b/server/src/main/java/org/apache/iotdb/db/engine/selectinto/InsertTabletPlanGenerator.java index 6847a8a..32418c0 100644 --- a/server/src/main/java/org/apache/iotdb/db/engine/selectinto/InsertTabletPlanGenerator.java +++ b/server/src/main/java/org/apache/iotdb/db/engine/selectinto/InsertTabletPlanGenerator.java @@ -183,6 +183,7 @@ public class InsertTabletPlanGenerator { break; case TEXT: columns[i] = new Binary[tabletRowLimit]; + Arrays.fill((Binary[]) columns[i], Binary.EMPTY_VALUE); break; default: throw new UnSupportedDataTypeException(
