Skip to content

Add TSBlock #1

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

Merged
merged 10 commits into from
Jun 27, 2025
Merged

Add TSBlock #1

merged 10 commits into from
Jun 27, 2025

Conversation

lausannel
Copy link
Owner

No description provided.

@lausannel lausannel requested a review from Copilot May 24, 2025 15:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the TsBlock abstraction for batched time-series data, integrates it into the session data flow, and extends the buffer utilities.

  • Implemented TsBlock class with Deserialize support and new column decoders
  • Added RpcDataSet for RPC-based query result handling and updated SessionDataSet
  • Extended ByteBuffer with a GetBytesbyLength helper and updated SessionPool variable naming

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Apache.IoTDB/SessionPool.cs Renamed local dataset variable
src/Apache.IoTDB/DataStructure/TsBlock.cs Added TsBlock and deserialization logic
src/Apache.IoTDB/DataStructure/SessionDataSet.cs Introduced unused _rpcDataSet field and formatting changes
src/Apache.IoTDB/DataStructure/RpcDataSet.cs New RPC dataset handling class
src/Apache.IoTDB/DataStructure/Column_decoder.cs Added column decoder framework
src/Apache.IoTDB/DataStructure/ByteBuffer.cs Added GetBytesbyLength method
Comments suppressed due to low confidence (3)

src/Apache.IoTDB/SessionPool.cs:713

  • Local variable 'SessionDataSet' should use camelCase (e.g., 'sessionDataSet') to avoid confusion with the class name.
var SessionDataSet = await ExecuteQueryStatementAsync(sql);

src/Apache.IoTDB/DataStructure/ByteBuffer.cs:149

  • [nitpick] Method name 'GetBytesbyLength' should use consistent PascalCase ('GetBytesByLength') to align with .NET naming conventions.
public byte[] GetBytesbyLength(int length)

src/Apache.IoTDB/DataStructure/TsBlock.cs:24

  • Consider adding unit tests for TsBlock.Deserialize (and related decoders) to verify correct deserialization of various data types and encodings.
public static TsBlock Deserialize(ByteBuffer reader)

Close().Wait();
return false;
}

Copy link
Preview

Copilot AI May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fetching new results, the response payload is never assigned to '_queryResult'; you should update '_queryResult' with the new data (e.g., ' _queryResult = resp.ResultsList') before resetting the index.

Suggested change
_queryResult = resp.ResultsList;

Copilot uses AI. Check for mistakes.

@@ -454,8 +453,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.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个名称不太符合命名规范,可以稍微改一下

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

分别改成PrintDatasetByType、PrintDatasetByObject、PrintDatasetByString

{
res.Next();
Console.WriteLine(res.GetRow());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里和原来的语义保持一致吧,不打印

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved

@@ -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.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved

@@ -307,8 +305,7 @@ public async Task TestTestInsertTablets()
// 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.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

{
res.Next();
Console.WriteLine(res.GetRow());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@@ -324,8 +324,7 @@ public async Task TestDeleteData()
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.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@@ -336,8 +335,7 @@ public async Task TestDeleteData()
await session_pool.DeleteDataAsync(ts_path_lst, 2, 3);
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.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

res.ShowTableNames();
while (res.HasNext()) Console.WriteLine(res.Next());

UtilsTest.PrintDataSet2(res);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里语义相同

@lausannel lausannel merged commit 9c49167 into lausannel:main Jun 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants