You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/12/25 04:31:14 UTC
[iotdb] branch master updated: refactor: remove sort param from Session (#4616)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 829bfe4 refactor: remove sort param from Session (#4616)
829bfe4 is described below
commit 829bfe424cd62beffac5daf063c603cbbcfd7307
Author: SzyWilliam <48...@users.noreply.github.com>
AuthorDate: Sat Dec 25 12:30:23 2021 +0800
refactor: remove sort param from Session (#4616)
---
.../apache/iotdb/session/IoTDBSessionSimpleIT.java | 2 +-
.../java/org/apache/iotdb/session/Session.java | 27 ++++++++--------------
2 files changed, 10 insertions(+), 19 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 316063a..1bb64c0 100644
--- a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -731,7 +731,7 @@ public class IoTDBSessionSimpleIT {
session.close();
}
- @Test(expected = BatchExecutionException.class)
+ @Test
public void testInsertOneDeviceRecordsWithIncorrectOrder()
throws IoTDBConnectionException, StatementExecutionException {
session = new Session("127.0.0.1", 6667, "root", "root");
diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java b/session/src/main/java/org/apache/iotdb/session/Session.java
index 30532a9..da4da47 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -1189,7 +1189,7 @@ public class Session {
*
* <p>Each row could have same deviceId but different time, number of measurements
*
- * @param haveSorted whether the times have been sorted
+ * @param haveSorted deprecated, whether the times have been sorted
* @see Session#insertTablet(Tablet)
*/
public void insertRecordsOfOneDevice(
@@ -1242,7 +1242,7 @@ public class Session {
*
* <p>Each row could have same prefixPath but different time, number of measurements
*
- * @param haveSorted whether the times have been sorted
+ * @param haveSorted deprecated, whether the times have been sorted
* @see Session#insertTablet(Tablet)
*/
public void insertAlignedRecordsOfOneDevice(
@@ -1290,12 +1290,7 @@ public class Session {
"times, measurementsList and valuesList's size should be equal");
}
- if (haveSorted) {
- if (!checkSorted(times)) {
- throw new BatchExecutionException(
- "Times in InsertOneDeviceRecords are not in ascending order");
- }
- } else {
+ if (!checkSorted(times)) {
// sort
Integer[] index = new Integer[times.size()];
for (int i = 0; i < times.size(); i++) {
@@ -1422,7 +1417,7 @@ public class Session {
* insert a Tablet
*
* @param tablet data batch
- * @param sorted whether times in Tablet are in ascending order
+ * @param sorted deprecated, whether times in Tablet are in ascending order
*/
public void insertTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
@@ -1454,7 +1449,7 @@ public class Session {
* insert the aligned timeseries data of a device.
*
* @param tablet data batch
- * @param sorted whether times in Tablet are in ascending order
+ * @param sorted deprecated, whether times in Tablet are in ascending order
*/
public void insertAlignedTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
@@ -1464,9 +1459,7 @@ public class Session {
private TSInsertTabletReq genTSInsertTabletReq(Tablet tablet, boolean sorted)
throws BatchExecutionException {
- if (sorted) {
- checkSortedThrowable(tablet);
- } else {
+ if (!checkSorted(tablet)) {
sortTablet(tablet);
}
@@ -1503,7 +1496,7 @@ public class Session {
* measurements is the same.
*
* @param tablets data batch in multiple device
- * @param sorted whether times in each Tablet are in ascending order
+ * @param sorted deprecated, whether times in each Tablet are in ascending order
*/
public void insertTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
@@ -1540,7 +1533,7 @@ public class Session {
* measurements is the same.
*
* @param tablets data batch in multiple device
- * @param sorted whether times in each Tablet are in ascending order
+ * @param sorted deprecated, whether times in each Tablet are in ascending order
*/
public void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
@@ -1581,9 +1574,7 @@ public class Session {
private void updateTSInsertTabletsReq(TSInsertTabletsReq request, Tablet tablet, boolean sorted)
throws BatchExecutionException {
- if (sorted) {
- checkSortedThrowable(tablet);
- } else {
+ if (!checkSorted(tablet)) {
sortTablet(tablet);
}
request.addToPrefixPaths(tablet.prefixPath);