You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/09/16 07:17:38 UTC
[iotdb] 01/01: [To rel/0.13][IOTDB-4428] partial insert by session NPE add IT
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch iotdb-4428-13
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2eed5e21ce60d25515ba986dba3b7710dbbe6c8f
Author: HTHou <hh...@outlook.com>
AuthorDate: Fri Sep 16 15:17:20 2022 +0800
[To rel/0.13][IOTDB-4428] partial insert by session NPE add IT
---
.../apache/iotdb/session/IoTDBSessionSimpleIT.java | 28 +++++++++++++++-------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
index dc7db03795..af6a32151a 100644
--- a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -125,6 +125,12 @@ public class IoTDBSessionSimpleIT {
session = new Session("127.0.0.1", 6667, "root", "root");
session.open();
+ session.createTimeseries(
+ "root.sg.d.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.LZ4);
+ session.createTimeseries(
+ "root.sg.d.s2", TSDataType.FLOAT, TSEncoding.PLAIN, CompressionType.LZ4);
+ session.createTimeseries(
+ "root.sg.d.s3", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.LZ4);
List<MeasurementSchema> schemaList = new ArrayList<>();
schemaList.add(new MeasurementSchema("s1", TSDataType.INT64));
schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE));
@@ -132,33 +138,39 @@ public class IoTDBSessionSimpleIT {
Tablet tablet = new Tablet("root.sg.d", schemaList, 10);
- long timestamp = System.currentTimeMillis();
-
for (long row = 0; row < 15; row++) {
int rowIndex = tablet.rowSize++;
- tablet.addTimestamp(rowIndex, timestamp);
+ tablet.addTimestamp(rowIndex, row);
tablet.addValue("s1", rowIndex, 1L);
tablet.addValue("s2", rowIndex, 1D);
tablet.addValue("s3", rowIndex, new Binary("1"));
if (tablet.rowSize == tablet.getMaxRowNumber()) {
- session.insertTablet(tablet, true);
+ try {
+ session.insertTablet(tablet, true);
+ } catch (StatementExecutionException e) {
+ Assert.assertTrue(e.getMessage().contains("DataType mismatch"));
+ }
tablet.reset();
}
- timestamp++;
}
if (tablet.rowSize != 0) {
- session.insertTablet(tablet);
+ try {
+ session.insertTablet(tablet);
+ } catch (StatementExecutionException e) {
+ Assert.assertTrue(e.getMessage().contains("DataType mismatch"));
+ }
tablet.reset();
}
- SessionDataSet dataSet = session.executeQueryStatement("select count(*) from root");
+ SessionDataSet dataSet = session.executeQueryStatement("select count(*) from root.**");
while (dataSet.hasNext()) {
RowRecord rowRecord = dataSet.next();
Assert.assertEquals(15L, rowRecord.getFields().get(0).getLongV());
Assert.assertEquals(15L, rowRecord.getFields().get(1).getLongV());
- Assert.assertEquals(15L, rowRecord.getFields().get(2).getLongV());
+ Assert.assertEquals(0, rowRecord.getFields().get(2).getLongV());
}
+ dataSet.close();
session.close();
}