Fix SessionDataSet: row count, async dispose, and null measurement issues (#53, #54, #55) (#56)

* Fix SessionDataSet: row count, async dispose, and null measurement issues (#53, #54, #55)
修复 SessionDataSet 行数统计、异步释放及空值测点问题

- Fix CurrentBatchRowCount() always returning 0 by eagerly constructing
  the first TsBlock in RpcDataSet constructor when initial data is available
  修复 CurrentBatchRowCount() 始终返回 0 的问题,在构造函数中预先反序列化首个 TsBlock

- Add IAsyncDisposable to SessionDataSet and RpcDataSet, providing
  DisposeAsync() that properly awaits Close() to avoid sync-over-async deadlocks
  为 SessionDataSet 和 RpcDataSet 添加 IAsyncDisposable 接口,支持 await using 语法

- Fix GetRow() including null-valued columns in RowRecord by using
  IsNull() check before calling type-specific getters, instead of relying
  on value type null checks which always pass for int/bool/float/etc.
  修复 GetRow() 中值类型默认值绕过 null 检查导致空值列被错误包含的问题

* Fix SessionDataSet.Close() idempotency and add regression tests
修复 SessionDataSet.Close() 幂等性问题并添加回归测试

- Set _isClosed = true in Close() finally block to prevent
  NullReferenceException on repeated Close/Dispose/DisposeAsync calls
  在 Close() 的 finally 块中设置 _isClosed = true,防止重复调用导致空引用异常

- Add RpcDataSetTests covering:
  - CurrentBatchRowCount returns correct size before first row read
  - CurrentBatchRowCount returns 0 when no data
  - GetRow excludes null-valued measurements for value types (BOOLEAN, INT32, DOUBLE)
  - DataTypes/Measurements/Values lists stay consistent
  添加 RpcDataSet 回归测试覆盖行数统计和空值测点排除
3 files changed
tree: f4ff62d5c524f2293af32d618e411f73e6fa4d13
  1. .github/
  2. Apache-IoTDB-Client-CSharp-UserCase/
  3. docs/
  4. samples/
  5. src/
  6. tests/
  7. .asf.yaml
  8. .dockerignore
  9. .editorconfig
  10. .gitattributes
  11. .gitignore
  12. .licenserc.yaml
  13. .pre-commit-config.yaml
  14. Apache.IoTDB.sln
  15. docker-compose-2c2d.yml
  16. docker-compose.yml
  17. launchSettings.json
  18. LICENSE
  19. PUBLISH.md
  20. README.md
  21. README_ZH.md
README.md

English | 中文

Apache IoTDB Client for C#

E2E Tests License NuGet Version NuGet Downloads

Overview

This is the C# client of Apache IoTDB.

Apache IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.

Apache IoTDB website: https://iotdb.apache.org Apache IoTDB Github: https://github.com/apache/iotdb

Installation

Install from NuGet Package

We have prepared a Nuget Package for C# users. Users can directly install the Apache IoTDB client using the .NET CLI. To install, simply run the following command in your command line:

dotnet add package Apache.IoTDB

For more details, visit the package on NuGet.

[!NOTE] The Apache.IoTDB package only supports versions greater than .net framework 4.6.1.

Prerequisites

.NET SDK Version >= 5.0 
.NET Framework >= 4.6.1

How to Use the Client (Quick Start)

Users can quickly get started by referring to the use cases under the Apache-IoTDB-Client-CSharp-UserCase directory. These use cases serve as a useful resource for getting familiar with the client's functionality and capabilities.

For those who wish to delve deeper into the client's usage and explore more advanced features, the samples directory contains additional code samples.

Developer environment requirements for iotdb-client-csharp

.NET SDK Version >= 5.0
.NET Framework >= 4.6.1
ApacheThrift >= 0.14.1
NLog >= 4.7.9

OS

  • Linux, MacOS or other Unix-like OS
  • Windows + Bash (WSL, cygwin, Git Bash)

Command Line Tools

  • dotnet CLI
  • Thrift

Code Formatting

This project uses dotnet format to enforce consistent code style based on the .editorconfig rules.

Check formatting locally

dotnet format --verify-no-changes

Auto-fix formatting issues

dotnet format

The CI pipeline will automatically check code formatting on all pull requests. Please ensure your code is properly formatted before submitting a PR.

Publish your own client on nuget.org

You can find out how to publish from this doc.