Fix SessionDataSet: row count, async dispose, and null measurement issues (#53, #54, #55)#56
Conversation
…sues (apache#53, apache#54, apache#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 检查导致空值列被错误包含的问题
HTHou
left a comment
There was a problem hiding this comment.
Thanks for the fixes. The main direction looks good: eager TsBlock construction addresses CurrentBatchRowCount(), and the explicit null check in GetRow() fixes the value-type default-value issue.
One thing I think should be fixed before merge: SessionDataSet.Close() still never sets _isClosed = true. After the first successful close it also sets _client = null, so a second call to Close() can enter the same branch again and dereference _client.SessionId. This becomes more visible now that both Dispose() and DisposeAsync() route through Close(). Could we make Close() idempotent, for example by marking _isClosed = true in the close path before returning the client and avoiding re-adding a null/already-returned client?
It would also be great to add regression tests for:
CurrentBatchRowCount()returning the first TsBlock size before reading the first row.GetRow()excluding null-valued measurements for value types likeBOOLEAN,INT32, andDOUBLE.
修复 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 回归测试覆盖行数统计和空值测点排除
fixed |
HTHou
left a comment
There was a problem hiding this comment.
Thanks, the requested idempotency fix and regression tests are in place. CI is green and the changes look good to me.
Unexpected behavior of the CurrentBatchRowCount() method #53 Fix CurrentBatchRowCount() always returning 0 by eagerly constructing the first TsBlock in RpcDataSet constructor when initial data is available 修复 CurrentBatchRowCount() 始终返回 0 的问题,在构造函数中预先反序列化首个 TsBlock
Why doesn’t SessionDataSet implement the IAsyncDisposable interface? #54 Add IAsyncDisposable to SessionDataSet and RpcDataSet, providing DisposeAsync() that properly awaits Close() to avoid sync-over-async deadlocks 为 SessionDataSet 和 RpcDataSet 添加 IAsyncDisposable 接口,支持 await using 语法
Unexpected behavior of the Next() method in SessionDataSet #55 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 检查导致空值列被错误包含的问题