Skip to content

Commit

Permalink
fix(src/Drivers/Apache): correctly handle empty response and add Clie…
Browse files Browse the repository at this point in the history
…nt tests
  • Loading branch information
birschick-bq committed Oct 23, 2024
1 parent 6d2a6dd commit 6a0a647
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions csharp/test/Apache.Arrow.Adbc.Tests/DriverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public static async Task CanExecuteQueryAsync(QueryResult queryResult, long expe
while (queryResult.Stream != null)
{
RecordBatch nextBatch = await queryResult.Stream.ReadNextRecordBatchAsync();
if (expectedNumberOfResults == 0)
{
Assert.Null(nextBatch);
}
if (nextBatch == null) { break; }
count += nextBatch.Length;
}
Expand Down
16 changes: 16 additions & 0 deletions csharp/test/Drivers/Apache/Spark/DriverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,22 @@ public void CanDetectInvalidServer()
OutputHelper?.WriteLine(exception.Message);
}

/// <summary>
/// Validates if the driver can connect to a live server and
/// parse the results using the asynchronous methods.
/// </summary>
[SkippableFact, Order(15)]
public async Task CanExecuteQueryAsyncEmptyResult()
{
using AdbcConnection adbcConnection = NewConnection();
using AdbcStatement statement = adbcConnection.CreateStatement();

statement.SqlQuery = $"SELECT * from {TestConfiguration.Metadata.Table} WHERE FALSE";
QueryResult queryResult = await statement.ExecuteQueryAsync();

await Tests.DriverTests.CanExecuteQueryAsync(queryResult, 0);
}

public static IEnumerable<object[]> CatalogNamePatternData()
{
string? catalogName = new DriverTests(null).TestConfiguration?.Metadata?.Catalog;
Expand Down

0 comments on commit 6a0a647

Please sign in to comment.