Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenHoangSon96 committed Dec 4, 2024
1 parent ba6c319 commit f1eab81
Showing 1 changed file with 45 additions and 43 deletions.
88 changes: 45 additions & 43 deletions Client.Test/InfluxDBClientQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ public async Task PassHeadersToFlightClient()
mockFlightSqlClient.Verify(m => m.Execute(query, "my-db", queryType, new Dictionary<string, object>(), headers), Times.Exactly(1));
}

[Test]
public async Task bar()
{
// todo: remove
// [Test]
// public async Task bar()
// {
// var hostCloud = "https://us-east-1-1.aws.cloud2.influxdata.com";
// var adminTokenCloud =
// "xWh3VQCb3pMJPw7T2lnEwFLXO-pb4OWzfNN76UTpmRKtlg83yJlz6maLC3AL0B6M6gMWWZY2QApzSdEeEopWlQ==";
Expand All @@ -145,45 +146,46 @@ public async Task bar()
// database: "admin");
// const string query = "select * from host10";
// var a = await client.QueryPoints(query).ToListAsync();
var meta = new Dictionary<string, string>
{
{
"iox::column::type", "iox::column_type::field::integer"
}
};

Field intField = new Field("column2", Int32Type.Default, true, meta);

}
// var meta = new Dictionary<string, string>
// {
// {
// "iox::column::type", "iox::column_type::field::integer"
// }
// };
//
// Field intField = new Field("column2", Int32Type.Default, true, meta);
//
// }

[Test]
public void fooTest()
{
var meta = new Dictionary<string, string>
{
{
"iox::column::type", "iox::column_type::field::integer"
}
};

Field intField = new Field("column2", Int32Type.Default, true, meta);
Int32Array intArray = new Int32Array.Builder().Append(1).Append(2).AppendNull().Append(4).Build();
Schema schema1 = new Schema(new[] { intField, }, null);
RecordBatch recordBatch = new RecordBatch(schema1, new IArrowArray[] { intArray }, intArray.Length);

var rowCount = recordBatch.Column(0).Length;
for (var i = 0; i < rowCount; i++)
{
for (var j = 0; j < recordBatch.ColumnCount; j++)
{
var schema = recordBatch.Schema.FieldsList[j];
var type = schema.Metadata["iox::column::type"];
var parts = type.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
var valueType = parts[2];

Console.WriteLine(valueType);
}
}

}
// todo: remove
// [Test]
// public void fooTest()
// {
// var meta = new Dictionary<string, string>
// {
// {
// "iox::column::type", "iox::column_type::field::integer"
// }
// };
//
// Field intField = new Field("column2", Int32Type.Default, true, meta);
// Int32Array intArray = new Int32Array.Builder().Append(1).Append(2).AppendNull().Append(4).Build();
// Schema schema1 = new Schema(new[] { intField, }, null);
// RecordBatch recordBatch = new RecordBatch(schema1, new IArrowArray[] { intArray }, intArray.Length);
//
// var rowCount = recordBatch.Column(0).Length;
// for (var i = 0; i < rowCount; i++)
// {
// for (var j = 0; j < recordBatch.ColumnCount; j++)
// {
// var schema = recordBatch.Schema.FieldsList[j];
// var type = schema.Metadata["iox::column::type"];
// var parts = type.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
// var valueType = parts[2];
//
// Console.WriteLine(valueType);
// }
// }
//
// }
}

0 comments on commit f1eab81

Please sign in to comment.