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 2022/08/05 06:16:28 UTC
[iotdb] branch master updated: [IOTDB-4023]C++ interface execute SQL query statement and the returned result set records error (#6870)
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 d037f1b739 [IOTDB-4023]C++ interface execute SQL query statement and the returned result set records error (#6870)
d037f1b739 is described below
commit d037f1b739f3f80557f6cad4d42eb2e6f5afdd53
Author: liruizhi19 <10...@users.noreply.github.com>
AuthorDate: Fri Aug 5 14:16:23 2022 +0800
[IOTDB-4023]C++ interface execute SQL query statement and the returned result set records error (#6870)
---
client-cpp/src/main/Session.cpp | 12 ++++++++++++
client-cpp/src/test/cpp/sessionIT.cpp | 28 ++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp
index 64c0ea0741..2b14a67f88 100644
--- a/client-cpp/src/main/Session.cpp
+++ b/client-cpp/src/main/Session.cpp
@@ -274,6 +274,18 @@ bool SessionDataSet::hasNext() {
} else {
tsQueryDataSet = make_shared<TSQueryDataSet>(resp->queryDataSet);
tsQueryDataSetTimeBuffer.str = tsQueryDataSet->time;
+ tsQueryDataSetTimeBuffer.pos = 0;
+ for (size_t i = 0; i < columnNameList.size(); i++) {
+ valueBuffers.pop_back();
+ bitmapBuffers.pop_back();
+ }
+ for (size_t i = 0; i < columnNameList.size(); i++) {
+ std::string name = columnNameList[i];
+ valueBuffers.push_back(
+ std::unique_ptr<MyStringBuffer>(new MyStringBuffer(tsQueryDataSet->valueList[columnMap[name]])));
+ bitmapBuffers.push_back(
+ std::unique_ptr<MyStringBuffer>(new MyStringBuffer(tsQueryDataSet->bitmapList[columnMap[name]])));
+ }
rowsIndex = 0;
}
}
diff --git a/client-cpp/src/test/cpp/sessionIT.cpp b/client-cpp/src/test/cpp/sessionIT.cpp
index 4f83e30965..a011220039 100644
--- a/client-cpp/src/test/cpp/sessionIT.cpp
+++ b/client-cpp/src/test/cpp/sessionIT.cpp
@@ -293,3 +293,31 @@ TEST_CASE("Test Last query ", "[testLastQuery]") {
index++;
}
}
+
+TEST_CASE("Test Huge query ", "[testHugeQuery]") {
+ prepareTimeseries();
+ string deviceId = "root.test.d1";
+ vector<string> measurements = {"s1", "s2", "s3"};
+ vector<TSDataType::TSDataType> types = {TSDataType::INT32, TSDataType::INT32, TSDataType::INT32};
+ int value1 = 1, value2 = 2, value3 = 3;
+ vector<char*> values = {(char*)&value1, (char*)&value2, (char*)&value3};
+
+ for (long time = 0; time < 1000000; time++) {
+ session->insertRecord(deviceId, time, measurements, types, values);
+ }
+
+ unique_ptr<SessionDataSet> sessionDataSet = session->executeQueryStatement("select * from root.test.d1");
+ sessionDataSet->setBatchSize(1024);
+ RowRecord* rowRecord;
+ int count = 0;
+ while (sessionDataSet->hasNext()) {
+ rowRecord = sessionDataSet->next();
+ REQUIRE(rowRecord->timestamp == count);
+ REQUIRE(rowRecord->fields[0].intV == 1);
+ REQUIRE(rowRecord->fields[1].intV == 2);
+ REQUIRE(rowRecord->fields[2].intV == 3);
+ count++;
+ }
+
+ REQUIRE(count == 1000000);
+}