Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 32 additions & 9 deletions src/Apache.IoTDB/DataStructure/RpcDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace Apache.IoTDB.DataStructure
{
public class RpcDataSet : System.IDisposable
public class RpcDataSet : System.IDisposable, System.IAsyncDisposable
{
private const string TimestampColumnName = "Time";
private const string DefaultTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
Expand Down Expand Up @@ -60,8 +60,8 @@
public int _tsBlockSize;
private int _tsBlockIndex;
private TimeZoneInfo _zoneId;
private int _timeFactor;

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0

Check warning on line 63 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timeFactor' is never assigned to, and will always have its default value 0
private string _timePrecision;

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null

Check warning on line 64 in src/Apache.IoTDB/DataStructure/RpcDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Field 'RpcDataSet._timePrecision' is never assigned to, and will always have its default value null
private bool disposedValue;

public RpcDataSet(string sql, List<string> columnNameList, List<string> columnTypeList,
Expand Down Expand Up @@ -140,6 +140,11 @@
_tsBlockSize = 0;
_tsBlockIndex = -1;

if (HasCachedByteBuffer())
{
ConstructOneTsBlock();
}

_zoneId = FindTimeZoneSafe(zoneId);

if (columnIndex2TsBlockColumnIndexList.Count != _columnNameList.Count)
Expand Down Expand Up @@ -172,6 +177,22 @@
GC.SuppressFinalize(this);
}

public async ValueTask DisposeAsync()
{
if (!disposedValue)
{
try
{
await Close().ConfigureAwait(false);
}
catch
{
}
disposedValue = true;
}
GC.SuppressFinalize(this);
}

public async Task Close()
{
if (_isClosed) return;
Expand Down Expand Up @@ -634,11 +655,9 @@
long timestamp = 0;
foreach (string columnName in columns)
{
object localfield;
string typeStr = _columnTypeList[i];
TSDataType dataType = Client.GetDataTypeByStr(typeStr);

// Identify the real time column by tsBlock index, not by data type
int tsBlockColumnIndex = GetTsBlockColumnIndexForColumnName(columnName);
if (tsBlockColumnIndex == -1)
{
Expand All @@ -647,6 +666,13 @@
continue;
}

if (IsNull(tsBlockColumnIndex, _tsBlockIndex))
{
i += 1;
continue;
}

object localfield;
switch (dataType)
{
case TSDataType.BOOLEAN:
Expand Down Expand Up @@ -682,12 +708,9 @@
string err_msg = "value format not supported";
throw new TException(err_msg, null);
}
if (localfield != null)
{
fieldList.Add(localfield);
measurementList.Add(columnName);
dataTypeList.Add(dataType);
}
fieldList.Add(localfield);
measurementList.Add(columnName);
dataTypeList.Add(dataType);
i += 1;
}
return new RowRecord(timestamp, fieldList, measurementList, dataTypeList);
Expand Down
18 changes: 17 additions & 1 deletion src/Apache.IoTDB/DataStructure/SessionDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace Apache.IoTDB.DataStructure
{
public class SessionDataSet : System.IDisposable
public class SessionDataSet : System.IDisposable, System.IAsyncDisposable
{
private readonly long _queryId;
private readonly long _statementId;
Expand Down Expand Up @@ -184,5 +184,21 @@ public void Dispose()
Dispose(disposing: true);
GC.SuppressFinalize(this);
}

public async ValueTask DisposeAsync()
{
if (!disposedValue)
{
try
{
await this.Close().ConfigureAwait(false);
}
catch
{
}
disposedValue = true;
}
GC.SuppressFinalize(this);
}
}
}
Loading