Skip to content

C# Client support V2 read interface #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:

jobs:
formatting-checks:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions Apache-IoTDB-Client-CSharp-UserCase/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ static async Task ExecuteQueryStatement()
await session_pool.Open(false);
var res = await session_pool.ExecuteQueryStatementAsync("select * from root.ln.wf01.wt01");
res.ShowTableNames();
while (res.HasNext())
while (res.Next())
{
Console.WriteLine(res.Next());
Console.WriteLine(res.GetRow());
}
await res.Close();
await session_pool.Close();
Expand Down
32 changes: 14 additions & 18 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.AlignedRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ public async Task TestInsertAlignedStringRecord()
Console.WriteLine(string.Format("total insert aligned string record time is {0}", end_ms - start_ms));
var res = await session_pool.ExecuteQueryStatementAsync("select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_cnt = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_cnt++;
}
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
Expand Down Expand Up @@ -185,8 +184,10 @@ public async Task TestInsertAlignedRecords()
System.Diagnostics.Debug.Assert(status == 0);
var res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<10");
res.ShowTableNames();
while (res.HasNext()) Console.WriteLine(res.Next());
UtilsTest.PrintDataSetByString(res);
Console.WriteLine(rowRecords);

System.Diagnostics.Debug.Assert(true);

await res.Close();
Console.WriteLine(status);
Expand Down Expand Up @@ -214,10 +215,10 @@ public async Task TestInsertAlignedRecords()
res.ShowTableNames();
var record_count = fetchSize * processedSize;
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
Console.WriteLine(res.GetRow());
}

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

await res.Close();

Expand Down Expand Up @@ -297,9 +297,9 @@ public async Task TestInsertAlignedStringRecords()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
Console.WriteLine(res.GetRow());
res_count += 1;
}

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

await res.Close();
rowRecords = new List<RowRecord>() { };
Expand All @@ -407,9 +406,8 @@ public async Task TestInsertAlignedRecordsOfOneDevice()
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

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

await res.Close();
// large data test
Expand All @@ -481,9 +478,8 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

Expand Down
12 changes: 4 additions & 8 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.AlignedTablet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public async Task TestInsertAlignedTablet()
System.Diagnostics.Debug.Assert(status == 0);
var res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<15");
res.ShowTableNames();
while (res.HasNext()) Console.WriteLine(res.Next());
UtilsTest.PrintDataSetByString(res);

await res.Close();
// large data test
Expand Down Expand Up @@ -84,9 +83,8 @@ public async Task TestInsertAlignedTablet()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

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

// large data test
var tasks = new List<Task<int>>();
Expand All @@ -177,9 +174,8 @@ public async Task TestInsertAlignedTablets()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

Expand Down
54 changes: 23 additions & 31 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ public async Task TestInsertStringRecord()
Console.WriteLine(string.Format("total insert string record time is {0}", end_ms - start_ms));
var res = await session_pool.ExecuteQueryStatementAsync("select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_cnt = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_cnt++;
}
Console.WriteLine(res_cnt + " " + fetchSize * processedSize);
Expand Down Expand Up @@ -149,8 +148,7 @@ public async Task TestInsertStrRecord()
System.Diagnostics.Debug.Assert(status == 0);
var res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<2");
res.ShowTableNames();
while (res.HasNext()) Console.WriteLine(res.Next());
UtilsTest.PrintDataSetByString(res);

await res.Close();

Expand All @@ -171,9 +169,8 @@ public async Task TestInsertStrRecord()
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

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

await res.Close();
Console.WriteLine(status);
Expand All @@ -282,12 +278,13 @@ public async Task TestInsertRecords()
Task.WaitAll(tasks.ToArray());
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();

var record_count = fetchSize * processedSize;

res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

Expand All @@ -300,16 +297,16 @@ public async Task TestInsertRecords()
res = await session_pool.ExecuteQueryStatementAsync(sql);
res.ShowTableNames();
RowRecord row = null;
while (res.HasNext())
while (res.Next())
{
row = res.Next();
row = res.GetRow();
break;
}

Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[0]} {testMeasurements[3]}");
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[0]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[1]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[2]);
Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[1]} {testMeasurements[3]}");
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[1]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[2]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[3]);

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

await res.Close();

Expand Down Expand Up @@ -384,9 +380,9 @@ public async Task TestInsertStringRecords()
res.ShowTableNames();
var record_count = fetchSize * processedSize;
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
Console.WriteLine(res.GetRow());
res_count += 1;
}

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

await res.Close();
// large data test
Expand All @@ -490,9 +485,8 @@ public async Task TestInsertRecordsOfOneDevice()
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

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

await res.Close();
// large data test
Expand All @@ -570,9 +563,8 @@ public async Task TestInsertStringRecordsOfOneDevice()
res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

Expand Down Expand Up @@ -651,9 +643,9 @@ public async Task TestInsertRecordsWithAllType()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
Console.WriteLine(res.Next());
Console.WriteLine(res.GetRow());
res_count += 1;
}

Expand Down
20 changes: 8 additions & 12 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.Tablet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public async Task TestInsertTablet()
System.Diagnostics.Debug.Assert(status == 0);
var res = await session_pool.ExecuteQueryStatementAsync(
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice) + " where time<15");
res.ShowTableNames();
while (res.HasNext()) Console.WriteLine(res.Next());
UtilsTest.PrintDataSetByString(res);

await res.Close();
// large data test
Expand Down Expand Up @@ -84,9 +83,8 @@ public async Task TestInsertTablet()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

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

// large data test

Expand Down Expand Up @@ -178,9 +175,8 @@ public async Task TestInsertTablets()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevices[1]));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
res.Next();
res_count += 1;
}

Expand Down Expand Up @@ -217,9 +213,9 @@ public async Task TestInsertTabletWithNullValue()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
Console.WriteLine(res.Next());
Console.WriteLine(res.GetRow());
res_count += 1;
}

Expand Down Expand Up @@ -280,9 +276,9 @@ public async Task TestInsertTabletWithAllType()
"select * from " + string.Format("{0}.{1}", testDatabaseName, testDevice));
res.ShowTableNames();
var res_count = 0;
while (res.HasNext())
while (res.Next())
{
Console.WriteLine(res.Next());
Console.WriteLine(res.GetRow());
res_count += 1;
}

Expand Down
Loading
Loading