Skip to content

Commit acad11b

Browse files
committed
BigQueryResults breaking change.
* TotalRows is now ulong? instead of ulong. * SafeTotalRows has been removed.
1 parent 694e91b commit acad11b

2 files changed

Lines changed: 4 additions & 17 deletions

File tree

apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2.IntegrationTests/QueryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ public void DmlQuery()
668668
$"INSERT INTO {table} (player, gameStarted, score) VALUES (@player, @gameStarted, @score)",
669669
parameters)
670670
.ThrowOnAnyError();
671-
Assert.Null(results.SafeTotalRows);
671+
Assert.Null(results.TotalRows);
672672
Assert.Equal(1, results.NumDmlAffectedRows);
673673

674674
// This used to query the whole table; now it returns empty results (as we're using GetQueryResults rather than ListRows).
@@ -683,8 +683,8 @@ public void ScriptQuery()
683683
string sql = "DECLARE accumulator INT64 DEFAULT 5; SELECT accumulator;";
684684
var results = client.ExecuteQuery(sql, null).ThrowOnAnyError();
685685

686-
Assert.True(results.SafeTotalRows.HasValue);
687-
Assert.Equal<ulong>(1, results.SafeTotalRows.Value);
686+
Assert.True(results.TotalRows.HasValue);
687+
Assert.Equal<ulong>(1, results.TotalRows.Value);
688688

689689
var row = results.Single();
690690
Assert.Equal((long)5, row[0]);

apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2/BigQueryResults.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
using Google.Api.Gax;
1616
using Google.Apis.Bigquery.v2.Data;
1717
using Google.Apis.Requests;
18-
using System;
1918
using System.Collections;
2019
using System.Collections.Generic;
2120
using System.Linq;
@@ -50,22 +49,10 @@ public sealed class BigQueryResults : IEnumerable<BigQueryRow>
5049
/// </summary>
5150
public TableReference TableReference { get; }
5251

53-
/// <summary>
54-
/// The total number of rows in the results.
55-
/// </summary>
56-
/// <remarks>
57-
/// In certain cases, the query results do not provide a row count. In these cases, accessing this property
58-
/// will throw an <see cref="InvalidOperationException"/>. The <see cref="SafeTotalRows"/> property provides
59-
/// a way of accessing the same value, but with a nullable value which will be null if the query results do not
60-
/// provide a row count.
61-
/// </remarks>
62-
/// <exception cref="InvalidOperationException">The query results do not provide a row count.</exception>
63-
public ulong TotalRows => _response.TotalRows.Value;
64-
6552
/// <summary>
6653
/// The total number of rows in the results, or <c>null</c> if the query results do not provide a row count.
6754
/// </summary>
68-
public ulong? SafeTotalRows => _response.TotalRows;
55+
public ulong? TotalRows => _response.TotalRows;
6956

7057
/// <summary>
7158
/// The total number of rows affected by a DML statement, or <c>null</c> for non-DML results.

0 commit comments

Comments
 (0)