Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenHoangSon96 committed Dec 9, 2024
1 parent 4cc8d6b commit 06a8537
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Client.Test/Internal/TypeCastTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ public void GetMappedValue()
});


field = GenerateIntFieldNullTypeMeta(fieldName);
field = GenerateIntFieldTestTypeMeta(fieldName);
Assert.That(TypeCasting.GetMappedValue(field, 1)!, Is.EqualTo(1));
}

private static Field GenerateIntFieldNullTypeMeta(string fieldName)
private static Field GenerateIntFieldTestTypeMeta(string fieldName)
{
var meta = new Dictionary<string, string>
{
{
"iox::column::type", null
"iox::column::type", "iox::column_type::field::test"
}
};
return new Field(fieldName, Int64Type.Default, true, meta);
Expand Down
12 changes: 1 addition & 11 deletions Client/InfluxDBClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,16 +466,9 @@ public InfluxDBClient() : this(
for (var j = 0; j < columnCount; j++)
{
if (batch.Column(j) is not ArrowArray array) continue;
var value = array.GetObjectValue(i);
if (value is null)
{
row[j] = null;
continue;
}

row[j] = TypeCasting.GetMappedValue(
batch.Schema.FieldsList[j],
value
array.GetObjectValue(i)
);
}

Expand Down Expand Up @@ -546,9 +539,6 @@ public async IAsyncEnumerable<PointDataValues> QueryPoints(string query, QueryTy
continue;

var objectValue = array.GetObjectValue(i);
if (objectValue is null)
continue;

if (fullName is "measurement" or "iox::measurement" &&
objectValue is string value)
{
Expand Down
5 changes: 4 additions & 1 deletion Client/Internal/TypeCasting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ public class TypeCasting
/// <param name="field">The Field object from Arrow</param>
/// <param name="value">The value to cast</param>
/// <returns>The value with the correct type</returns>
public static object GetMappedValue(Field field, object value)
public static object? GetMappedValue(Field field, object? value)
{
if (value == null)
return null;

var fieldName = field.Name;
if (fieldName is "measurement" or "iox::measurement")
{
Expand Down

0 comments on commit 06a8537

Please sign in to comment.