ClickHouse.Client
ClickHouse.Client copied to clipboard
Apache Arrow format
Hello, can the library use the Apache Arrow format to receive data? If yes, then how?
Hello, yes, it's possible:
using var connection = new ClickHouseConnection("host=localhost;port=8123;database=mydb;username=user;");
await using var command = connection.CreateCommand();
command.CommandText = "select * from my_table format ArrowStream";
var result = await command.ExecuteRawResultAsync(cancellationToken);
await using var stream = await result.ReadAsStreamAsync();
using var reader = new ArrowStreamReader(stream, new CompressionCodecFactory());
var recordBatch = await reader.ReadNextRecordBatchAsync(cancellationToken);
Console.WriteLine(recordBatch.ColumnCount);
If it's not too much trouble, could you explain why this might be needed and what are the use cases for it, please? I'm just curious.