Skip to content

Commit bbf0506

Browse files
lausannelfpddmw
andauthored
C# Client support V2 read interface (#37)
* 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> * fix comments (#2) * 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 * fix pull request * fix valueIsNull --------- Co-authored-by: xxhz22 <1791961174@qq.com> * change thrift compiler version to 0.14.1 * fix compilation issue caused by 0.14.1 * fix samples and other compilation error * fix samples build error * format code * remove unused UtilsTest and Tests files; add UtilsTests in NUnit for endpoint parsing and utility functions * format and add restore before format * fix compilation error * fix compilation error * fix `GetRow` in Use Case * fix spell * fix spell --------- Co-authored-by: xxhz22 <1791961174@qq.com>
1 parent 1f0e60b commit bbf0506

File tree

67 files changed

+5491
-1418
lines changed

Some content is hidden

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

67 files changed

+5491
-1418
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

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
hooks:
66
- id: dotnet-format
77
name: dotnet format
8-
entry: dotnet format --include
8+
entry: bash -lc "dotnet restore && dotnet format --include --no-restore"
99
language: system
1010
pass_filenames: true
1111
files: '\.(cs|vb|fs|sln|csproj|fsproj)$'

samples/Apache.IoTDB.Samples/Program.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ public static async Task Main(string[] args)
5050

5151
rootCommand.SetHandler(async (string single, List<string> multi) =>
5252
{
53-
var utilsTest = new UtilsTest();
54-
utilsTest.TestParseEndPoint();
55-
5653
SessionPoolTest sessionPoolTest;
5754

5855
if (!string.IsNullOrEmpty(single) && (multi == null || multi.Count == 0))

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public async Task TestInsertAlignedStringRecord()
100100
var res_cnt = 0;
101101
while (res.HasNext())
102102
{
103-
res.Next();
104103
res_cnt++;
104+
res.Next();
105105
}
106106
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
107107
System.Diagnostics.Debug.Assert(res_cnt == fetchSize * processedSize);
@@ -185,8 +185,10 @@ public async Task TestInsertAlignedRecords()
185185
System.Diagnostics.Debug.Assert(status == 0);
186186
var res = await session_pool.ExecuteQueryStatementAsync(
187187
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
188-
res.ShowTableNames();
189-
while (res.HasNext()) Console.WriteLine(res.Next());
188+
SessionPoolTest.PrintDataSetByString(res);
189+
Console.WriteLine(rowRecords);
190+
191+
System.Diagnostics.Debug.Assert(true);
190192

191193
await res.Close();
192194
Console.WriteLine(status);
@@ -216,8 +218,8 @@ public async Task TestInsertAlignedRecords()
216218
var res_count = 0;
217219
while (res.HasNext())
218220
{
219-
res.Next();
220221
res_count += 1;
222+
Console.WriteLine(res.Next());
221223
}
222224

223225
await res.Close();
@@ -265,8 +267,7 @@ public async Task TestInsertAlignedStringRecords()
265267
System.Diagnostics.Debug.Assert(status == 0);
266268
var res = await session_pool.ExecuteQueryStatementAsync(
267269
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
268-
res.ShowTableNames();
269-
while (res.HasNext()) Console.WriteLine(res.Next());
270+
SessionPoolTest.PrintDataSetByString(res);
270271

271272
await res.Close();
272273

@@ -299,7 +300,7 @@ public async Task TestInsertAlignedStringRecords()
299300
var res_count = 0;
300301
while (res.HasNext())
301302
{
302-
res.Next();
303+
Console.WriteLine(res.Next());
303304
res_count += 1;
304305
}
305306

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

392392
await res.Close();
393393
rowRecords = new List<RowRecord>() { };
@@ -409,8 +409,8 @@ public async Task TestInsertAlignedRecordsOfOneDevice()
409409
var res_count = 0;
410410
while (res.HasNext())
411411
{
412-
res.Next();
413412
res_count += 1;
413+
res.Next();
414414
}
415415

416416
await res.Close();
@@ -454,8 +454,7 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
454454
System.Diagnostics.Debug.Assert(status == 0);
455455
var res = await session_pool.ExecuteQueryStatementAsync(
456456
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
457-
res.ShowTableNames();
458-
while (res.HasNext()) Console.WriteLine(res.Next());
457+
SessionPoolTest.PrintDataSetByString(res);
459458

460459
await res.Close();
461460
// large data test
@@ -483,8 +482,8 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
483482
var res_count = 0;
484483
while (res.HasNext())
485484
{
486-
res.Next();
487485
res_count += 1;
486+
res.Next();
488487
}
489488

490489
await res.Close();

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

Lines changed: 4 additions & 6 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+
SessionPoolTest.PrintDataSetByString(res);
5958

6059
await res.Close();
6160
// large data test
@@ -86,8 +85,8 @@ public async Task TestInsertAlignedTablet()
8685
var res_count = 0;
8786
while (res.HasNext())
8887
{
89-
res.Next();
9088
res_count += 1;
89+
res.Next();
9190
}
9291

9392
await res.Close();
@@ -149,8 +148,7 @@ public async Task TestInsertAlignedTablets()
149148
System.Diagnostics.Debug.Assert(status == 0);
150149
var res = await session_pool.ExecuteQueryStatementAsync(
151150
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]) + " where time<15");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
151+
SessionPoolTest.PrintDataSetByString(res);
154152

155153
// large data test
156154
var tasks = new List<Task<int>>();
@@ -179,8 +177,8 @@ public async Task TestInsertAlignedTablets()
179177
var res_count = 0;
180178
while (res.HasNext())
181179
{
182-
res.Next();
183180
res_count += 1;
181+
res.Next();
184182
}
185183

186184
await res.Close();

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public async Task TestInsertStringRecord()
113113
var res_cnt = 0;
114114
while (res.HasNext())
115115
{
116-
res.Next();
117116
res_cnt++;
117+
res.Next();
118118
}
119119
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
120120
System.Diagnostics.Debug.Assert(res_cnt == fetchSize * processedSize);
@@ -149,8 +149,7 @@ public async Task TestInsertStrRecord()
149149
System.Diagnostics.Debug.Assert(status == 0);
150150
var res = await session_pool.ExecuteQueryStatementAsync(
151151
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<2");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
152+
SessionPoolTest.PrintDataSetByString(res);
154153

155154
await res.Close();
156155

@@ -173,8 +172,8 @@ public async Task TestInsertStrRecord()
173172
var res_count = 0;
174173
while (res.HasNext())
175174
{
176-
res.Next();
177175
res_count += 1;
176+
res.Next();
178177
}
179178

180179
await res.Close();
@@ -256,8 +255,7 @@ public async Task TestInsertRecords()
256255
System.Diagnostics.Debug.Assert(status == 0);
257256
var res = await session_pool.ExecuteQueryStatementAsync(
258257
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
259-
res.ShowTableNames();
260-
while (res.HasNext()) Console.WriteLine(res.Next());
258+
SessionPoolTest.PrintDataSetByString(res);
261259

262260
await res.Close();
263261
Console.WriteLine(status);
@@ -282,13 +280,15 @@ public async Task TestInsertRecords()
282280
Task.WaitAll(tasks.ToArray());
283281
res = await session_pool.ExecuteQueryStatementAsync(
284282
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
285-
res.ShowTableNames();
283+
286284
var record_count = fetchSize * processedSize;
285+
286+
res.ShowTableNames();
287287
var res_count = 0;
288288
while (res.HasNext())
289289
{
290-
res.Next();
291290
res_count += 1;
291+
res.Next();
292292
}
293293

294294
await res.Close();
@@ -306,10 +306,10 @@ public async Task TestInsertRecords()
306306
break;
307307
}
308308

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]);
309+
Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[1]} {testMeasurements[3]}");
310+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[1]);
311+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[2]);
312+
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[3]);
313313

314314
status = await session_pool.DeleteDatabaseAsync(testDatabaseName);
315315
System.Diagnostics.Debug.Assert(status == 0);
@@ -351,8 +351,7 @@ public async Task TestInsertStringRecords()
351351
System.Diagnostics.Debug.Assert(status == 0);
352352
var res = await session_pool.ExecuteQueryStatementAsync(
353353
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
354-
res.ShowTableNames();
355-
while (res.HasNext()) Console.WriteLine(res.Next());
354+
SessionPoolTest.PrintDataSetByString(res);
356355

357356
await res.Close();
358357

@@ -386,7 +385,7 @@ public async Task TestInsertStringRecords()
386385
var res_count = 0;
387386
while (res.HasNext())
388387
{
389-
res.Next();
388+
Console.WriteLine(res.Next());
390389
res_count += 1;
391390
}
392391

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

474472
await res.Close();
475473
// large data test
@@ -492,8 +490,8 @@ public async Task TestInsertRecordsOfOneDevice()
492490
var res_count = 0;
493491
while (res.HasNext())
494492
{
495-
res.Next();
496493
res_count += 1;
494+
res.Next();
497495
}
498496

499497
await res.Close();
@@ -543,8 +541,7 @@ public async Task TestInsertStringRecordsOfOneDevice()
543541
System.Diagnostics.Debug.Assert(status == 0);
544542
var res = await session_pool.ExecuteQueryStatementAsync(
545543
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
546-
res.ShowTableNames();
547-
while (res.HasNext()) Console.WriteLine(res.Next());
544+
SessionPoolTest.PrintDataSetByString(res);
548545

549546
await res.Close();
550547
// large data test
@@ -572,8 +569,8 @@ public async Task TestInsertStringRecordsOfOneDevice()
572569
var res_count = 0;
573570
while (res.HasNext())
574571
{
575-
res.Next();
576572
res_count += 1;
573+
res.Next();
577574
}
578575

579576
await res.Close();

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

Lines changed: 4 additions & 6 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+
SessionPoolTest.PrintDataSetByString(res);
6059

6160
await res.Close();
6261
// large data test
@@ -86,8 +85,8 @@ public async Task TestInsertTablet()
8685
var res_count = 0;
8786
while (res.HasNext())
8887
{
89-
res.Next();
9088
res_count += 1;
89+
res.Next();
9190
}
9291

9392
await res.Close();
@@ -149,8 +148,7 @@ public async Task TestInsertTablets()
149148
// System.Diagnostics.Debug.Assert(status == 0);
150149
var res = await session_pool.ExecuteQueryStatementAsync(
151150
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]) + " where time<15");
152-
res.ShowTableNames();
153-
while (res.HasNext()) Console.WriteLine(res.Next());
151+
SessionPoolTest.PrintDataSetByString(res);
154152

155153
// large data test
156154

@@ -180,8 +178,8 @@ public async Task TestInsertTablets()
180178
var res_count = 0;
181179
while (res.HasNext())
182180
{
183-
res.Next();
184181
res_count += 1;
182+
res.Next();
185183
}
186184

187185
await res.Close();

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ public async Task TestTestInsertRecords()
144144
// System.Diagnostics.Debug.Assert(status == 0);
145145
var res = await session_pool.ExecuteQueryStatementAsync(
146146
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
147-
res.ShowTableNames();
148-
while (res.HasNext()) Console.WriteLine(res.Next());
147+
SessionPoolTest.PrintDataSetByString(res);
149148

150149
await res.Close();
151150

@@ -174,8 +173,8 @@ public async Task TestTestInsertRecords()
174173
var res_count = 0;
175174
while (res.HasNext())
176175
{
177-
res.Next();
178176
res_count += 1;
177+
res.Next();
179178
}
180179

181180
await res.Close();
@@ -214,8 +213,7 @@ public async Task TestTestInsertTablet()
214213
System.Diagnostics.Debug.Assert(status == 0);
215214
var res = await session_pool.ExecuteQueryStatementAsync(
216215
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<15");
217-
res.ShowTableNames();
218-
while (res.HasNext()) Console.WriteLine(res.Next());
216+
SessionPoolTest.PrintDataSetByString(res);
219217

220218
await res.Close();
221219
// large data test
@@ -245,8 +243,8 @@ public async Task TestTestInsertTablet()
245243
var res_count = 0;
246244
while (res.HasNext())
247245
{
248-
res.Next();
249246
res_count += 1;
247+
res.Next();
250248
}
251249

252250
await res.Close();
@@ -307,8 +305,7 @@ public async Task TestTestInsertTablets()
307305
// System.Diagnostics.Debug.Assert(status == 0);
308306
var res = await session_pool.ExecuteQueryStatementAsync(
309307
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]) + " where time<15");
310-
res.ShowTableNames();
311-
while (res.HasNext()) Console.WriteLine(res.Next());
308+
SessionPoolTest.PrintDataSetByString(res);
312309
await res.Close();
313310

314311
// large data test
@@ -338,8 +335,8 @@ public async Task TestTestInsertTablets()
338335
var res_count = 0;
339336
while (res.HasNext())
340337
{
341-
res.Next();
342338
res_count += 1;
339+
res.Next();
343340
}
344341

345342
await res.Close();

0 commit comments

Comments
 (0)