Skip to content

Commit bbb7f43

Browse files
authored
Merge pull request #27 from PeterDRasmussen/master
Combining RowSet and chunks sometimes there are rowsets as well as chunks
2 parents 20689b7 + 2fab6a3 commit bbb7f43

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

Snowflake.Client.Tests/IntegrationTests/IntegrationTestBase.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ public IntegrationTestBase()
1414
var testParameters = JsonSerializer.Deserialize<TestConfiguration>(configJson, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
1515
var connectionInfo = testParameters.Connection;
1616

17-
_snowflakeClient = new SnowflakeClient(connectionInfo.User, connectionInfo.Password, connectionInfo.Account, connectionInfo.Region);
17+
_snowflakeClient = new SnowflakeClient(new Model.AuthInfo
18+
{
19+
User = connectionInfo.User,
20+
Password = connectionInfo.Password,
21+
Account = connectionInfo.Account,
22+
Region = connectionInfo.Region
23+
},
24+
new Model.SessionInfo
25+
{
26+
Warehouse = connectionInfo.Warehouse
27+
});
1828
}
1929
}
2030
}

Snowflake.Client.Tests/IntegrationTests/SnowflakeChunksDownloaderTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ public async Task QueryAndMap_ResponseWithChunks()
2929

3030
Assert.AreEqual(selectCount, records.Count);
3131
}
32+
33+
[Test]
34+
public async Task QueryAndMap_ResponseWithChunks_AndRowset()
35+
{
36+
var selectCount = 1300;
37+
var result = await _snowflakeClient.QueryAsync<Supplier>($"select top {selectCount} * from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1000.SUPPLIER;");
38+
var records = result.ToList();
39+
40+
Assert.AreEqual(selectCount, records.Count);
41+
}
3242
}
3343

3444
internal class Supplier

Snowflake.Client/Helpers/SnowflakeUtils.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ internal static string GetCloudTagByRegion(string region)
7878
{ "eu-west-1", "" },
7979
{ "eu-west-2", "aws" },
8080
{ "eu-central-1", "" },
81+
{ "eu-north-1", "aws" },
8182
{ "ap-northeast-1", "aws" },
8283
{ "ap-south-1", "aws" },
8384
{ "ap-southeast-1", "" },

Snowflake.Client/SnowflakeClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ public async Task<IEnumerable<T>> QueryAsync<T>(string sql, object sqlParams = n
172172

173173
if (response.Data.Chunks != null && response.Data.Chunks.Count > 0)
174174
{
175-
rowSet = await ChunksDownloader.DownloadAndParseChunksAsync(new ChunksDownloadInfo()
175+
rowSet.AddRange(await ChunksDownloader.DownloadAndParseChunksAsync(new ChunksDownloadInfo()
176176
{
177177
ChunkHeaders = response.Data.ChunkHeaders,
178178
Chunks = response.Data.Chunks,
179179
Qrmk = response.Data.Qrmk
180-
}, ct);
180+
}, ct));
181181
}
182182

183183
var result = SnowflakeDataMapper.MapTo<T>(response.Data.RowType, rowSet);

0 commit comments

Comments
 (0)