diff --git a/Snowflake.Data/Configuration/SFConfiguration.cs b/Snowflake.Data/Configuration/SFConfiguration.cs index 6945c3b4b..1ff42be8f 100755 --- a/Snowflake.Data/Configuration/SFConfiguration.cs +++ b/Snowflake.Data/Configuration/SFConfiguration.cs @@ -10,12 +10,18 @@ public class SFConfiguration { public Boolean UseV2JsonParser; + // Leave this configuration for backward compatibility. + // We would discard it after we announce this change. + // Right now, when this is true, it would disable the ChunkDownloaderVersion public Boolean UseV2ChunkDownloader; + public int ChunkDownloaderVersion; + private SFConfiguration() { UseV2JsonParser = true; UseV2ChunkDownloader = false; + ChunkDownloaderVersion = 3; } private readonly static SFConfiguration Config = new SFConfiguration(); diff --git a/Snowflake.Data/Core/ChunkDownloaderFactory.cs b/Snowflake.Data/Core/ChunkDownloaderFactory.cs index f84020292..fd803ad72 100755 --- a/Snowflake.Data/Core/ChunkDownloaderFactory.cs +++ b/Snowflake.Data/Core/ChunkDownloaderFactory.cs @@ -14,16 +14,25 @@ public static IChunkDownloader GetDownloader(QueryExecResponseData responseData, CancellationToken cancellationToken) { if (SFConfiguration.Instance().UseV2ChunkDownloader) + SFConfiguration.Instance().ChunkDownloaderVersion = 2; + + switch (SFConfiguration.Instance().ChunkDownloaderVersion) { - return new SFChunkDownloaderV2(responseData.rowType.Count, + case 1: + return new SFBlockingChunkDownloader(responseData.rowType.Count, responseData.chunks, responseData.qrmk, responseData.chunkHeaders, - cancellationToken); - } - else - { - return new SFBlockingChunkDownloaderV3(responseData.rowType.Count, + cancellationToken, + resultSet); + case 2: + return new SFChunkDownloaderV2(responseData.rowType.Count, + responseData.chunks, + responseData.qrmk, + responseData.chunkHeaders, + cancellationToken); + default: + return new SFBlockingChunkDownloaderV3(responseData.rowType.Count, responseData.chunks, responseData.qrmk, responseData.chunkHeaders,