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

Conversation

lausannel
Copy link
Collaborator

@lausannel lausannel commented Jun 27, 2025

Introduced a V2 data reading interface based on TSBlock, aligned with the design of the Go client

* 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 <[email protected]>
@lausannel lausannel requested a review from CritasWang June 27, 2025 08:38

var resp = task.ConfigureAwait(false).GetAwaiter().GetResult();
public RowRecord GetRow() => _rpcDataSet.GetRow();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the user's performance unchanged
HasNext
Next
This can be used as a new method, but the semantics of the old method should not be changed
public RowRecord GetRow() => _rpcDataSet.GetRow();

@CritasWang CritasWang requested a review from Copilot June 30, 2025 04:13
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 a V2 data reading interface based on TSBlock and aligns the C# client design with the Go client. Key changes include:

  • Changing default timezone identifiers from "UTC+08:00" to "Asia/Shanghai".
  • Updating SessionPool calls to new RPC methods (dropping Async suffix) and wiring up TSBlock-based streaming.
  • Adding core data‐structure support: TsBlock, RpcDataSet, ColumnDecoder, Column, and extending ByteBuffer.

Reviewed Changes

Copilot reviewed 22 out of 125 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TableSessionPool.Builder.cs, SessionPool.Builder.cs Updated default _zoneId initialization to "Asia/Shanghai".
SessionPool.cs Swapped deprecated async calls for new V2 methods; updated timezone.
DataStructure/TsBlock.cs Added TsBlock deserialization and validation logic.
DataStructure/RpcDataSet.cs New streaming class to iterate through TSBlocks over RPC V2.
DataStructure/ColumnDecoder.cs, Column.cs Core interfaces and implementations for decoding column data.
DataStructure/ByteBuffer.cs Added GetBytesbyLength helper for length‐based reads.
DataStructure/SessionDataSet.cs Refactored to delegate to RpcDataSet with new constructor.
Client.cs Added GetDataTypeByStr helper for mapping string types to enum.
IoTDBDataReader.cs Updated to use Next()/GetRow() instead of HasNext()/Next().
IoTDBConnectionStringBuilder.cs Updated default _zoneId to "Asia/Shanghai".
samples/… Refactored sample tests to use PrintDataSetByString and Next().
.github/workflows/pre-commit-format.yml Upgraded runner from Ubuntu 20.04 to Ubuntu 22.04.
Comments suppressed due to low confidence (4)

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

  • Method name 'GetBytesbyLength' uses inconsistent casing; consider renaming to 'GetBytesByLength' to match .NET naming conventions.
        public byte[] GetBytesbyLength(int length)

src/Apache.IoTDB/DataStructure/SessionDataSet.cs:52

  • [nitpick] Parameter '_clientQueueS' begins with an underscore and uppercase letter, which conflicts with C# parameter naming conventions. Consider renaming to 'clientQueue'.
        public SessionDataSet(

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

  • [nitpick] Variable 'valuecolumnEncodings' should be renamed to 'valueColumnEncodings' to follow camelCase convention and improve readability.
            var valuecolumnEncodings = new ColumnEncoding[valueColumnCount];

src/Apache.IoTDB/DataStructure/RpcDataSet.cs:29

  • Public types and methods lack XML documentation comments. Consider adding summaries to explain usage for key public APIs like RpcDataSet.
    public class RpcDataSet : System.IDisposable

public class IntColumn : PrimitiveColumn<int>
{
public IntColumn(int arrayOffset, int positionCount, bool[] valueIsNull, int[] values)
: base(
Copy link
Preview

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

Constructors ignore the passed 'valueIsNull' array by hardcoding it to null; this discards null-indicator information. Pass the actual 'valueIsNull' parameter to the base class.

Copilot uses AI. Check for mistakes.

@CritasWang
Copy link
Contributor

image
At present, iotdb itself will build csharp's RPC interface during the build process. Is it necessary to update Thrift to 0.15.0. Perhaps it would be better to maintain unity with IoTDB?

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