diff --git a/.gitignore b/.gitignore index 89b62f9..7e907c3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,10 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user +# JetBrains Rider +.idea/ +*.sln.iml + # NuGet *.nupkg *.snupkg diff --git a/trino-csharp/Trino.Client.Test/Trino.Client.Test.csproj b/trino-csharp/Trino.Client.Test/Trino.Client.Test.csproj index 7093e7b..39b7a99 100644 --- a/trino-csharp/Trino.Client.Test/Trino.Client.Test.csproj +++ b/trino-csharp/Trino.Client.Test/Trino.Client.Test.csproj @@ -50,6 +50,9 @@ PreserveNewest + + PreserveNewest + diff --git a/trino-csharp/Trino.Client.Test/TrinoClientTests.cs b/trino-csharp/Trino.Client.Test/TrinoClientTests.cs index 44e4e34..b81f68f 100644 --- a/trino-csharp/Trino.Client.Test/TrinoClientTests.cs +++ b/trino-csharp/Trino.Client.Test/TrinoClientTests.cs @@ -66,6 +66,28 @@ public void TestReadZeroRows() } } + /// + /// Test NaN values handling in the response + /// + [TestMethod] + public async Task TestNanProgress() + { + using (TrinoTestServer server = TrinoTestServer.Create("nan_progress.txt")) + { + var properties = server.GetConnectionProperties(); + properties.Catalog = "memory"; + + using (TrinoConnection tc = new(properties)) + { + using (TrinoCommand trinoCommand = new(tc, "INSERT INSERT memory.default.target_table (Id) SELECT Id FROM memory.default.target_table")) + { + var result = await trinoCommand.ExecuteNonQueryAsync(CancellationToken.None); + Assert.AreEqual(result, 0); + } + } + } + } + /// /// Test that after cancellation schema can still be retrieved. /// diff --git a/trino-csharp/Trino.Client.Test/scripts/nan_progress.txt b/trino-csharp/Trino.Client.Test/scripts/nan_progress.txt new file mode 100644 index 0000000..e91cefb --- /dev/null +++ b/trino-csharp/Trino.Client.Test/scripts/nan_progress.txt @@ -0,0 +1,4 @@ +Date=Tue, 05 Mar 2024 06:13:02 GMT|Connection=keep-alive|X-Content-Type-Options=nosniff|Vary=Accept-Encoding|Strict-Transport-Security=max-age=15724800; includeSubDomains| +{"id":"20250221_095950_00006_p6xi8","infoUri":"http://localhost/ui/query.html?20250221_095950_00006_p6xi8","nextUri":"http://localhost/v1/statement/executing/20250221_095950_00006_p6xi8/y45d228b42fc52c29776a876c0ab50e531346be8a/1","columns":[{"name":"rows","type":"bigint","typeSignature":{"rawType":"bigint","arguments":[]}}],"data":[[0]],"stats":{"state":"FINISHED","queued":false,"scheduled":true,"progressPercentage":"NaN","runningPercentage":"NaN","nodes":1,"totalSplits":18,"queuedSplits":0,"runningSplits":0,"completedSplits":18,"planningTimeMillis":446,"analysisTimeMillis":53,"cpuTimeMillis":277,"wallTimeMillis":338,"queuedTimeMillis":3,"elapsedTimeMillis":19819,"finishingTimeMillis":18102,"physicalInputTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"physicalWrittenBytes":0,"internalNetworkInputBytes":177,"peakMemoryBytes":265474,"spilledBytes":0,"rootStage":{"stageId":"0","state":"FINISHED","done":true,"nodes":1,"totalSplits":9,"queuedSplits":0,"runningSplits":0,"completedSplits":9,"cpuTimeMillis":35,"wallTimeMillis":59,"processedRows":2,"processedBytes":177,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":true,"subStages":[{"stageId":"1","state":"FINISHED","done":true,"nodes":1,"totalSplits":9,"queuedSplits":0,"runningSplits":0,"completedSplits":9,"cpuTimeMillis":242,"wallTimeMillis":279,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":false,"subStages":[{"stageId":"2","state":"FINISHED","done":true,"nodes":1,"totalSplits":0,"queuedSplits":0,"runningSplits":0,"completedSplits":0,"cpuTimeMillis":0,"wallTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":false,"subStages":[]}]}]}},"warnings":[],"updateType":"INSERT","updateCount":0} +Date=Tue, 05 Mar 2024 06:13:02 GMT|Connection=keep-alive|X-Content-Type-Options=nosniff|Vary=Accept-Encoding|Strict-Transport-Security=max-age=15724800; includeSubDomains| +{"id":"20250221_095950_00006_p6xi8","infoUri":"http://localhost/ui/query.html?20250221_095950_00006_p6xi8","columns":[{"name":"rows","type":"bigint","typeSignature":{"rawType":"bigint","arguments":[]}}],"stats":{"state":"FINISHED","queued":false,"scheduled":true,"progressPercentage":"NaN","runningPercentage":"NaN","nodes":1,"totalSplits":18,"queuedSplits":0,"runningSplits":0,"completedSplits":18,"planningTimeMillis":446,"analysisTimeMillis":53,"cpuTimeMillis":277,"wallTimeMillis":338,"queuedTimeMillis":3,"elapsedTimeMillis":19819,"finishingTimeMillis":18102,"physicalInputTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"physicalWrittenBytes":0,"internalNetworkInputBytes":177,"peakMemoryBytes":265474,"spilledBytes":0,"rootStage":{"stageId":"0","state":"FINISHED","done":true,"nodes":1,"totalSplits":9,"queuedSplits":0,"runningSplits":0,"completedSplits":9,"cpuTimeMillis":35,"wallTimeMillis":59,"processedRows":2,"processedBytes":177,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":true,"subStages":[{"stageId":"1","state":"FINISHED","done":true,"nodes":1,"totalSplits":9,"queuedSplits":0,"runningSplits":0,"completedSplits":9,"cpuTimeMillis":242,"wallTimeMillis":279,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":false,"subStages":[{"stageId":"2","state":"FINISHED","done":true,"nodes":1,"totalSplits":0,"queuedSplits":0,"runningSplits":0,"completedSplits":0,"cpuTimeMillis":0,"wallTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"failedTasks":0,"coordinatorOnly":false,"subStages":[]}]}]}},"warnings":[],"updateType":"INSERT","updateCount":0} diff --git a/trino-csharp/Trino.Client/Model/StatementV1/TrinoStats.cs b/trino-csharp/Trino.Client/Model/StatementV1/TrinoStats.cs index 9f0b939..1249469 100644 --- a/trino-csharp/Trino.Client/Model/StatementV1/TrinoStats.cs +++ b/trino-csharp/Trino.Client/Model/StatementV1/TrinoStats.cs @@ -47,7 +47,7 @@ public bool scheduled public long processedBytes { get; set; } public long peakMemoryBytes { get; set; } public long spilledBytes { get; set; } - public long progressPercentage { get; set; } + public double progressPercentage { get; set; } /// /// Get the query execution progress percentage as a ratio