Skip to content

Commit 9c49167

Browse files
lausannelfpddmw
andauthored
Add TSBlock (#1)
* add tsblock * develop tsblock and rpcdataset * improve code specifications * develop RpcDataSet api * coding api in SessionDataSet and rpcDataSet * fix bugs & pass test * adapted to IoTDBDataReader * adopted comments * add license and change ubuntu version * format code --------- Co-authored-by: xxhz22 <1791961174@qq.com>
1 parent 21fb2aa commit 9c49167

File tree

125 files changed

+11105
-7957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+11105
-7957
lines changed

.github/workflows/pre-commit-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
formatting-checks:
19-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-22.04
2020

2121
steps:
2222
- uses: actions/checkout@v4

Apache-IoTDB-Client-CSharp-UserCase/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ static async Task ExecuteQueryStatement()
9999
await session_pool.Open(false);
100100
var res = await session_pool.ExecuteQueryStatementAsync("select * from root.ln.wf01.wt01");
101101
res.ShowTableNames();
102-
while (res.HasNext())
102+
while (res.Next())
103103
{
104-
Console.WriteLine(res.Next());
104+
Console.WriteLine(res.GetRow());
105105
}
106106
await res.Close();
107107
await session_pool.Close();

samples/Apache.IoTDB.Samples/SessionPoolTest.AlignedRecord.cs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ public async Task TestInsertAlignedStringRecord()
9898
Console.WriteLine(string.Format("total insert aligned string record time is {0}", end_ms - start_ms));
9999
var res = await session_pool.ExecuteQueryStatementAsync("select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
100100
var res_cnt = 0;
101-
while (res.HasNext())
101+
while (res.Next())
102102
{
103-
res.Next();
104103
res_cnt++;
105104
}
106105
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
@@ -185,8 +184,10 @@ public async Task TestInsertAlignedRecords()
185184
System.Diagnostics.Debug.Assert(status == 0);
186185
var res = await session_pool.ExecuteQueryStatementAsync(
187186
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
188-
res.ShowTableNames();
189-
while (res.HasNext()) Console.WriteLine(res.Next());
187+
UtilsTest.PrintDataSetByString(res);
188+
Console.WriteLine(rowRecords);
189+
190+
System.Diagnostics.Debug.Assert(true);
190191

191192
await res.Close();
192193
Console.WriteLine(status);
@@ -214,10 +215,10 @@ public async Task TestInsertAlignedRecords()
214215
res.ShowTableNames();
215216
var record_count = fetchSize * processedSize;
216217
var res_count = 0;
217-
while (res.HasNext())
218+
while (res.Next())
218219
{
219-
res.Next();
220220
res_count += 1;
221+
Console.WriteLine(res.GetRow());
221222
}
222223

223224
await res.Close();
@@ -265,8 +266,7 @@ public async Task TestInsertAlignedStringRecords()
265266
System.Diagnostics.Debug.Assert(status == 0);
266267
var res = await session_pool.ExecuteQueryStatementAsync(
267268
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
268-
res.ShowTableNames();
269-
while (res.HasNext()) Console.WriteLine(res.Next());
269+
UtilsTest.PrintDataSetByString(res);
270270

271271
await res.Close();
272272

@@ -297,9 +297,9 @@ public async Task TestInsertAlignedStringRecords()
297297
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
298298
res.ShowTableNames();
299299
var res_count = 0;
300-
while (res.HasNext())
300+
while (res.Next())
301301
{
302-
res.Next();
302+
Console.WriteLine(res.GetRow());
303303
res_count += 1;
304304
}
305305

@@ -386,8 +386,7 @@ public async Task TestInsertAlignedRecordsOfOneDevice()
386386
System.Diagnostics.Debug.Assert(status == 0);
387387
var res = await session_pool.ExecuteQueryStatementAsync(
388388
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
389-
res.ShowTableNames();
390-
while (res.HasNext()) Console.WriteLine(res.Next());
389+
UtilsTest.PrintDataSetByString(res);
391390

392391
await res.Close();
393392
rowRecords = new List<RowRecord>() { };
@@ -407,9 +406,8 @@ public async Task TestInsertAlignedRecordsOfOneDevice()
407406
res = await session_pool.ExecuteQueryStatementAsync(
408407
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
409408
var res_count = 0;
410-
while (res.HasNext())
409+
while (res.Next())
411410
{
412-
res.Next();
413411
res_count += 1;
414412
}
415413

@@ -454,8 +452,7 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
454452
System.Diagnostics.Debug.Assert(status == 0);
455453
var res = await session_pool.ExecuteQueryStatementAsync(
456454
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
457-
res.ShowTableNames();
458-
while (res.HasNext()) Console.WriteLine(res.Next());
455+
UtilsTest.PrintDataSetByString(res);
459456

460457
await res.Close();
461458
// large data test
@@ -481,9 +478,8 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
481478
res = await session_pool.ExecuteQueryStatementAsync(
482479
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
483480
var res_count = 0;
484-
while (res.HasNext())
481+
while (res.Next())
485482
{
486-
res.Next();
487483
res_count += 1;
488484
}
489485

samples/Apache.IoTDB.Samples/SessionPoolTest.AlignedTablet.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public async Task TestInsertAlignedTablet()
5454
System.Diagnostics.Debug.Assert(status == 0);
5555
var res = await session_pool.ExecuteQueryStatementAsync(
5656
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<15");
57-
res.ShowTableNames();
58-
while (res.HasNext()) Console.WriteLine(res.Next());
57+
UtilsTest.PrintDataSetByString(res);
5958

6059
await res.Close();
6160
// large data test
@@ -84,9 +83,8 @@ public async Task TestInsertAlignedTablet()
8483
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
8584
res.ShowTableNames();
8685
var res_count = 0;
87-
while (res.HasNext())
86+
while (res.Next())
8887
{
89-
res.Next();
9088
res_count += 1;
9189
}
9290

@@ -149,8 +147,7 @@ public async Task TestInsertAlignedTablets()
149147
System.Diagnostics.Debug.Assert(status == 0);
150148
var res = await session_pool.ExecuteQueryStatementAsync(
151149
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]) + " where time<15");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
150+
UtilsTest.PrintDataSetByString(res);
154151

155152
// large data test
156153
var tasks = new List<Task<int>>();
@@ -177,9 +174,8 @@ public async Task TestInsertAlignedTablets()
177174
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]));
178175
res.ShowTableNames();
179176
var res_count = 0;
180-
while (res.HasNext())
177+
while (res.Next())
181178
{
182-
res.Next();
183179
res_count += 1;
184180
}
185181

samples/Apache.IoTDB.Samples/SessionPoolTest.Record.cs

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ public async Task TestInsertStringRecord()
111111
Console.WriteLine(string.Format("total insert string record time is {0}", end_ms - start_ms));
112112
var res = await session_pool.ExecuteQueryStatementAsync("select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
113113
var res_cnt = 0;
114-
while (res.HasNext())
114+
while (res.Next())
115115
{
116-
res.Next();
117116
res_cnt++;
118117
}
119118
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
@@ -149,8 +148,7 @@ public async Task TestInsertStrRecord()
149148
System.Diagnostics.Debug.Assert(status == 0);
150149
var res = await session_pool.ExecuteQueryStatementAsync(
151150
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<2");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
151+
UtilsTest.PrintDataSetByString(res);
154152

155153
await res.Close();
156154

@@ -171,9 +169,8 @@ public async Task TestInsertStrRecord()
171169
res = await session_pool.ExecuteQueryStatementAsync(
172170
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
173171
var res_count = 0;
174-
while (res.HasNext())
172+
while (res.Next())
175173
{
176-
res.Next();
177174
res_count += 1;
178175
}
179176

@@ -256,8 +253,7 @@ public async Task TestInsertRecords()
256253
System.Diagnostics.Debug.Assert(status == 0);
257254
var res = await session_pool.ExecuteQueryStatementAsync(
258255
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
259-
res.ShowTableNames();
260-
while (res.HasNext()) Console.WriteLine(res.Next());
256+
UtilsTest.PrintDataSetByString(res);
261257

262258
await res.Close();
263259
Console.WriteLine(status);
@@ -282,12 +278,13 @@ public async Task TestInsertRecords()
282278
Task.WaitAll(tasks.ToArray());
283279
res = await session_pool.ExecuteQueryStatementAsync(
284280
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
285-
res.ShowTableNames();
281+
286282
var record_count = fetchSize * processedSize;
283+
284+
res.ShowTableNames();
287285
var res_count = 0;
288-
while (res.HasNext())
286+
while (res.Next())
289287
{
290-
res.Next();
291288
res_count += 1;
292289
}
293290

@@ -300,16 +297,16 @@ public async Task TestInsertRecords()
300297
res = await session_pool.ExecuteQueryStatementAsync(sql);
301298
res.ShowTableNames();
302299
RowRecord row = null;
303-
while (res.HasNext())
300+
while (res.Next())
304301
{
305-
row = res.Next();
302+
row = res.GetRow();
306303
break;
307304
}
308305

309-
Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[0]} {testMeasurements[3]}");
310-
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[0]);
311-
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[1]);
312-
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[2]);
306+
Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[1]} {testMeasurements[3]}");
307+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[1]);
308+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[2]);
309+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[3]);
313310

314311
status = await session_pool.DeleteDatabaseAsync(testDatabaseName);
315312
System.Diagnostics.Debug.Assert(status == 0);
@@ -351,8 +348,7 @@ public async Task TestInsertStringRecords()
351348
System.Diagnostics.Debug.Assert(status == 0);
352349
var res = await session_pool.ExecuteQueryStatementAsync(
353350
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
354-
res.ShowTableNames();
355-
while (res.HasNext()) Console.WriteLine(res.Next());
351+
UtilsTest.PrintDataSetByString(res);
356352

357353
await res.Close();
358354

@@ -384,9 +380,9 @@ public async Task TestInsertStringRecords()
384380
res.ShowTableNames();
385381
var record_count = fetchSize * processedSize;
386382
var res_count = 0;
387-
while (res.HasNext())
383+
while (res.Next())
388384
{
389-
res.Next();
385+
Console.WriteLine(res.GetRow());
390386
res_count += 1;
391387
}
392388

@@ -468,8 +464,7 @@ public async Task TestInsertRecordsOfOneDevice()
468464
System.Diagnostics.Debug.Assert(status == 0);
469465
var res = await session_pool.ExecuteQueryStatementAsync(
470466
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
471-
res.ShowTableNames();
472-
while (res.HasNext()) Console.WriteLine(res.Next());
467+
UtilsTest.PrintDataSetByString(res);
473468

474469
await res.Close();
475470
// large data test
@@ -490,9 +485,8 @@ public async Task TestInsertRecordsOfOneDevice()
490485
res = await session_pool.ExecuteQueryStatementAsync(
491486
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
492487
var res_count = 0;
493-
while (res.HasNext())
488+
while (res.Next())
494489
{
495-
res.Next();
496490
res_count += 1;
497491
}
498492

@@ -543,8 +537,7 @@ public async Task TestInsertStringRecordsOfOneDevice()
543537
System.Diagnostics.Debug.Assert(status == 0);
544538
var res = await session_pool.ExecuteQueryStatementAsync(
545539
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
546-
res.ShowTableNames();
547-
while (res.HasNext()) Console.WriteLine(res.Next());
540+
UtilsTest.PrintDataSetByString(res);
548541

549542
await res.Close();
550543
// large data test
@@ -570,9 +563,8 @@ public async Task TestInsertStringRecordsOfOneDevice()
570563
res = await session_pool.ExecuteQueryStatementAsync(
571564
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
572565
var res_count = 0;
573-
while (res.HasNext())
566+
while (res.Next())
574567
{
575-
res.Next();
576568
res_count += 1;
577569
}
578570

@@ -651,9 +643,9 @@ public async Task TestInsertRecordsWithAllType()
651643
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
652644
res.ShowTableNames();
653645
var res_count = 0;
654-
while (res.HasNext())
646+
while (res.Next())
655647
{
656-
Console.WriteLine(res.Next());
648+
Console.WriteLine(res.GetRow());
657649
res_count += 1;
658650
}
659651

samples/Apache.IoTDB.Samples/SessionPoolTest.Tablet.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public async Task TestInsertTablet()
5555
System.Diagnostics.Debug.Assert(status == 0);
5656
var res = await session_pool.ExecuteQueryStatementAsync(
5757
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<15");
58-
res.ShowTableNames();
59-
while (res.HasNext()) Console.WriteLine(res.Next());
58+
UtilsTest.PrintDataSetByString(res);
6059

6160
await res.Close();
6261
// large data test
@@ -84,9 +83,8 @@ public async Task TestInsertTablet()
8483
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
8584
res.ShowTableNames();
8685
var res_count = 0;
87-
while (res.HasNext())
86+
while (res.Next())
8887
{
89-
res.Next();
9088
res_count += 1;
9189
}
9290

@@ -149,8 +147,7 @@ public async Task TestInsertTablets()
149147
// System.Diagnostics.Debug.Assert(status == 0);
150148
var res = await session_pool.ExecuteQueryStatementAsync(
151149
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]) + " where time<15");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
150+
UtilsTest.PrintDataSetByString(res);
154151

155152
// large data test
156153

@@ -178,9 +175,8 @@ public async Task TestInsertTablets()
178175
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]));
179176
res.ShowTableNames();
180177
var res_count = 0;
181-
while (res.HasNext())
178+
while (res.Next())
182179
{
183-
res.Next();
184180
res_count += 1;
185181
}
186182

@@ -217,9 +213,9 @@ public async Task TestInsertTabletWithNullValue()
217213
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
218214
res.ShowTableNames();
219215
var res_count = 0;
220-
while (res.HasNext())
216+
while (res.Next())
221217
{
222-
Console.WriteLine(res.Next());
218+
Console.WriteLine(res.GetRow());
223219
res_count += 1;
224220
}
225221

@@ -280,9 +276,9 @@ public async Task TestInsertTabletWithAllType()
280276
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
281277
res.ShowTableNames();
282278
var res_count = 0;
283-
while (res.HasNext())
279+
while (res.Next())
284280
{
285-
Console.WriteLine(res.Next());
281+
Console.WriteLine(res.GetRow());
286282
res_count += 1;
287283
}
288284

0 commit comments

Comments
 (0)