Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitattributes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought certain IDE files used CRLF?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that by not fixing it to one or the other you end up with certain IDEs automatically modifying the files. This means you need to manually handle this in git by reverting these changes or you end up in ding dong between different conventions people have. I believe fixing to one works better but open to other suggestions

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2025 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

* text=auto eol=lf
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,7 @@ validation-report.xml

# Git worktrees
.worktrees/

# Go shared library build artifacts
go/libadbc_driver_snowflake.so
go/libadbc_driver_snowflake.h
43 changes: 43 additions & 0 deletions csharp/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2025 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# EditorConfig for the C# workspace: the native Snowflake driver and its tests.
#
# Layout rules (whitespace, line endings, brace placement) are enforced so `dotnet format`
# is deterministic. Semantic style preferences (var, expression bodies) are documented at
# `silent` severity: they guide the IDE but are intentionally NOT auto-rewritten by
# `dotnet format`, so the tool never churns hand-written code.
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{json,yml,yaml}]
indent_size = 2

[*.cs]
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false

# Preferences the codebase follows, documented but not machine-enforced (silent = no format churn).
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
dotnet_style_require_accessibility_modifiers = never:silent
2 changes: 2 additions & 0 deletions csharp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

.vs
.vscode
.idea/
bin
obj
x64
Expand All @@ -22,6 +23,7 @@ x64
*.obj
*.exe
*.csproj.user
AdbcDrivers.Snowflake.sln.DotSettings.user
*.pass

artifacts/
Expand Down
93 changes: 93 additions & 0 deletions csharp/AdbcDrivers.Snowflake.sln
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33403.182
Expand All @@ -16,36 +17,124 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Inter
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Interop.Tests", "test\Interop\AdbcDrivers.Snowflake.Interop.Tests.csproj", "{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{986E768A-9E42-6229-8E82-349DB5D13BDD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Native", "src\Native\AdbcDrivers.Snowflake.Native.csproj", "{7554C6D5-B570-401D-859E-ECCA3D6BD25A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0C88DD14-F956-CE84-757C-A364CCF449FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{7BEB73B5-2377-DFD3-0252-3311B8DAB980}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Native.Tests", "test\Native\AdbcDrivers.Snowflake.Native.Tests.csproj", "{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|x64.ActiveCfg = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|x64.Build.0 = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|x86.ActiveCfg = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|x86.Build.0 = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|Any CPU.Build.0 = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|x64.ActiveCfg = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|x64.Build.0 = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|x86.ActiveCfg = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|x86.Build.0 = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|x64.ActiveCfg = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|x64.Build.0 = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|x86.ActiveCfg = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|x86.Build.0 = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|Any CPU.Build.0 = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|x64.ActiveCfg = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|x64.Build.0 = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|x86.ActiveCfg = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|x86.Build.0 = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|x64.Build.0 = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|x86.Build.0 = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|Any CPU.Build.0 = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|x64.ActiveCfg = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|x64.Build.0 = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|x86.ActiveCfg = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|x86.Build.0 = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|x64.ActiveCfg = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|x64.Build.0 = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|x86.ActiveCfg = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|x86.Build.0 = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|Any CPU.Build.0 = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|x64.ActiveCfg = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|x64.Build.0 = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|x86.ActiveCfg = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|x86.Build.0 = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|x64.ActiveCfg = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|x64.Build.0 = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|x86.ActiveCfg = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|x86.Build.0 = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|Any CPU.Build.0 = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|x64.ActiveCfg = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|x64.Build.0 = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|x86.ActiveCfg = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|x86.Build.0 = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|x64.ActiveCfg = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|x64.Build.0 = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|x86.ActiveCfg = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|x86.Build.0 = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|Any CPU.Build.0 = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|x64.ActiveCfg = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|x64.Build.0 = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|x86.ActiveCfg = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|x86.Build.0 = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|x64.ActiveCfg = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|x64.Build.0 = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|x86.ActiveCfg = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Debug|x86.Build.0 = Debug|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|Any CPU.Build.0 = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|x64.ActiveCfg = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|x64.Build.0 = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|x86.ActiveCfg = Release|Any CPU
{7554C6D5-B570-401D-859E-ECCA3D6BD25A}.Release|x86.Build.0 = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|x64.ActiveCfg = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|x64.Build.0 = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|x86.ActiveCfg = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Debug|x86.Build.0 = Debug|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|Any CPU.Build.0 = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|x64.ActiveCfg = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|x64.Build.0 = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|x86.ActiveCfg = Release|Any CPU
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -55,6 +144,10 @@ Global
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{986E768A-9E42-6229-8E82-349DB5D13BDD} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{7554C6D5-B570-401D-859E-ECCA3D6BD25A} = {986E768A-9E42-6229-8E82-349DB5D13BDD}
{7BEB73B5-2377-DFD3-0252-3311B8DAB980} = {0C88DD14-F956-CE84-757C-A364CCF449FC}
{3141B3F2-EF05-47FB-BBCA-5FA22AAC6515} = {7BEB73B5-2377-DFD3-0252-3311B8DAB980}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4795CF16-0FDB-4BE0-9768-5CF31564DC03}
Expand Down
135 changes: 135 additions & 0 deletions csharp/run_benchmark.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright (c) 2025 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Benchmark runner: native C# driver vs Go/Interop driver. Both projects expose an
# identically-shaped BenchmarkTests.BaselineQueryPerformance; this runs each suite 5
# times and parses the per-limit timings (the [NATIVE]/[INTEROP] log lines).

$ErrorActionPreference = "Stop"

# Determine the repository root from the location of this script.
# Assumes this script lives in the repository root. If you move it into
# a subdirectory (e.g. scripts\), change this to:
# $repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$repoRoot = $PSScriptRoot

# Resolve project paths
$nativeProject = Join-Path $repoRoot "test\Native\AdbcDrivers.Snowflake.Native.Tests.csproj"
$interopProject = Join-Path $repoRoot "test\Interop\AdbcDrivers.Snowflake.Interop.Tests.csproj"

# Use an existing SNOWFLAKE_TEST_CONFIG_FILE environment variable if present.
# Otherwise prompt the user for the config file.
if (-not $env:SNOWFLAKE_TEST_CONFIG_FILE) {
$env:SNOWFLAKE_TEST_CONFIG_FILE = Read-Host "Enter the full path to snowflakeconfig.local.json"
}

if (-not (Test-Path $env:SNOWFLAKE_TEST_CONFIG_FILE)) {
throw "Snowflake config file not found: '$($env:SNOWFLAKE_TEST_CONFIG_FILE)'"
}

Write-Host "Using Snowflake config: $env:SNOWFLAKE_TEST_CONFIG_FILE"

$outDir = Join-Path $env:TEMP "adbc_bench"
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
Get-ChildItem $outDir -Filter *.txt -ErrorAction SilentlyContinue | Remove-Item -Force

$runs = 5

Write-Output "########## NATIVE (C#) driver — BenchmarkTests ##########"
for ($i = 1; $i -le $runs; $i++) {
Write-Output "---- native run $i/$runs ----"
dotnet test $nativeProject -c Release --no-build `
--filter "FullyQualifiedName~BenchmarkTests.BaselineQueryPerformance" `
--logger "console;verbosity=detailed" 2>&1 |
Tee-Object -FilePath "$outDir\native_$i.txt" | Out-Null
}

Write-Output "########## INTEROP (Go) driver — BenchmarkTests ##########"
for ($i = 1; $i -le $runs; $i++) {
Write-Output "---- interop run $i/$runs ----"
dotnet test $interopProject -c Release --no-build `
--filter "FullyQualifiedName~BenchmarkTests.BaselineQueryPerformance" `
--logger "console;verbosity=detailed" 2>&1 |
Tee-Object -FilePath "$outDir\interop_$i.txt" | Out-Null
}

# ---- parse ----
function Get-Timings($glob) {
$map = @{}
foreach ($f in Get-ChildItem $outDir -Filter $glob) {
foreach ($line in Get-Content $f.FullName) {
if ($line -match 'for limit (\d+) in (\d+) ms') {
$limit = [int]$Matches[1]
$ms = [int]$Matches[2]
if (-not $map.ContainsKey($limit)) {
$map[$limit] = @()
}
$map[$limit] += $ms
}
}
}
return $map
}

function Show-Stats($name, $map) {
Write-Output ""
Write-Output "===== $name ====="
foreach ($limit in ($map.Keys | Sort-Object)) {
$vals = $map[$limit]
$mean = [math]::Round(($vals | Measure-Object -Average).Average, 0)
$min = ($vals | Measure-Object -Minimum).Minimum
$max = ($vals | Measure-Object -Maximum).Maximum

if ($vals.Count -gt 1) {
$sd = [math]::Round(
[math]::Sqrt(
(($vals |
ForEach-Object { [math]::Pow($_ - $mean, 2) } |
Measure-Object -Sum).Sum) / ($vals.Count - 1)
),
0
)
}
else {
$sd = 0
}

$joined = ($vals -join ', ')
Write-Output ("limit {0,8}: n={1} mean={2,7} ms min={3,7} max={4,7} sd={5,6} [{6}]" -f $limit, $vals.Count, $mean, $min, $max, $sd, $joined)
}
}

Write-Output ""
Write-Output "==================== RESULTS ===================="

$nat = Get-Timings "native_*.txt"
$intr = Get-Timings "interop_*.txt"

Show-Stats "NATIVE (C#)" $nat
Show-Stats "INTEROP (Go)" $intr

Write-Output ""
Write-Output "===== mean comparison (native / interop) ====="

foreach ($limit in ($nat.Keys | Sort-Object)) {
if ($intr.ContainsKey($limit)) {
$nm = ($nat[$limit] | Measure-Object -Average).Average
$im = ($intr[$limit] | Measure-Object -Average).Average
$ratio = [math]::Round($nm / $im, 2)

Write-Output ("limit {0,8}: native {1,7} ms vs interop {2,7} ms ratio={3}x" -f $limit, [math]::Round($nm, 0), [math]::Round($im, 0), $ratio)
}
}

Write-Output "DONE"
30 changes: 30 additions & 0 deletions csharp/src/Native/AdbcDrivers.Snowflake.Native.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<Description>Native C# Snowflake driver for Apache Arrow ADBC</Description>
</PropertyGroup>

<ItemGroup>
<!-- Abstractions only: the driver consumes ILogger/ILoggerFactory but never builds a provider.
JWT (key-pair auth) is hand-rolled over the in-box System.Security.Cryptography RSA. -->
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\arrow-adbc\csharp\src\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="AdbcDrivers.Snowflake.Native.Tests" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
</ItemGroup>

<ItemGroup>
<Content Include="readme.md">
<Pack>true</Pack>
<PackagePath>\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Loading