Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
933d752
modifiche per statistics
Apr 21, 2026
bc27930
primo impianto rilevamento metriche
Apr 24, 2026
319c9bf
primo impianto rilevamento metriche
Apr 24, 2026
258461f
review of profiling info and statistics management
May 8, 2026
e7a31bb
Merge branch 'v1.5.2' into #15889_Duckdb_idmv
May 8, 2026
97d1f3b
aggiornamento a duckdb 1.5.2 più alcune revisioni
May 8, 2026
b2af0f1
benchmark dot net project init
May 11, 2026
b55b126
added benchmark project
May 11, 2026
61a63cb
Merge branch 'benchmark-baseline' into #15889_Duckdb_idmv
May 11, 2026
56911b4
adjusted artifact path
May 11, 2026
8b1a219
Merge branch 'benchmark-baseline' into #15889_Duckdb_idmv
May 11, 2026
bfb4f4b
benchmark and some rework
May 13, 2026
e8a3b54
fix init profiling logic
May 13, 2026
f58b6e6
Refactor and enhance profiling functionality
May 19, 2026
1bef8e5
Refactor and enhance profiling support in DuckDB
May 19, 2026
b62ea9b
Add profilingOptions to duplicatedConnection initialization
May 19, 2026
ea5d5ff
Enhance time utilities and profiling logic
May 19, 2026
6bd3874
Refactor profiling and add SemVer support
May 20, 2026
d4a44a9
Refactor profiling and timing utilities
May 20, 2026
1870144
Refactor profiling and tracing system
May 20, 2026
120bc73
Bump version to 1.5.2.0-alpha.3
May 20, 2026
e2f484b
Refactor profiling and enable XML docs generation
May 22, 2026
096db61
Improve error handling and add profiling test
May 22, 2026
cd2447b
Bump version to 1.5.2.2-alpha.6 in README and irion.version
May 22, 2026
e22ba0e
Refactor and enhance profiling and execution tracing
May 25, 2026
fd36e5c
Add advanced profiling options and metrics threshold
May 27, 2026
2fb41dc
removed default from ProfilingOptions.MetricsThresholdMS
May 27, 2026
dd87b13
Add metrics threshold check to StatementProfiler
May 27, 2026
3130829
Refactor profiling system in DuckDBConnection
May 28, 2026
12af03b
Update profiling modes and version for release candidate
Jun 1, 2026
2ecc984
Refactor profiling logic in DuckDBConnection
Jun 1, 2026
a361c1f
readme
Jun 1, 2026
fc50722
removed trailing whitespace
Jun 5, 2026
30f81a0
removed trailing whitespace
Jun 5, 2026
60ea2f8
Refactor query profiling to use integer-based IDs
Jun 5, 2026
740e80f
Refactor queryProfilers key type to use int
Jun 5, 2026
5ac6ff6
Refactor profiling and improve error handling
Jun 5, 2026
0faffe4
Improve TimerUtils and profiling consistency
Jun 5, 2026
7b2f5fa
Refactor and extend DuckDB profiling and metrics support
Jun 5, 2026
cb15d0d
Improve profiling output handling and add related tests
Jun 8, 2026
4332fbe
Make QuerySummaryList nullable and update sample usage
Jun 8, 2026
ed53afa
Add Irion.DuckDB.NET.Benchmark project to solution
Jun 8, 2026
a66c251
Enhance native library download process with configurable retries and…
Jun 8, 2026
a51f1a7
Fix target framework version in benchmark project and improve version…
Jun 8, 2026
255cb95
Add support for including release notes in package metadata and enhan…
Jun 8, 2026
2a5875a
Update version to 1.5.2.2 and enhance release notes for ProfilingInfo…
Jun 8, 2026
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
16 changes: 16 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@
</None>
</ItemGroup>

<PropertyGroup>
<!-- When true, include RELEASE-NOTE.md from the repo root into each package. Disabled by default. -->
<IncludeReleaseNotesFromRepoRoot>false</IncludeReleaseNotesFromRepoRoot>
</PropertyGroup>

<PropertyGroup Condition="'$(IncludeReleaseNotesFromRepoRoot)' == 'true'">
<PackageReadmeFile>RELEASE-NOTE.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup Condition="'$(IncludeReleaseNotesFromRepoRoot)' == 'true' And Exists('..\RELEASE-NOTE.md')">
<None Include="..\RELEASE-NOTE.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<PropertyGroup Label="CI" Condition="'$(CI)' == ''">
<CI>false</CI>
<!-- GH, CircleCI, GitLab and BitBucket already use CI -->
Expand Down
7 changes: 6 additions & 1 deletion DuckDB.NET.Bindings/Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildType)' == 'ManagedOnly' ">
<Description>$(Description) $(NoNativeText)</Description>
</PropertyGroup>
Expand All @@ -36,7 +41,7 @@
<_NativeLib Include="linux-x64" LibUrl="$(DuckDbArtifactRoot)/duckdb-binaries-linux-amd64.zip" InnerZipName="libduckdb-linux-amd64.zip" Condition="$([MSBuild]::IsOSPlatform('Linux'))" />
<_NativeLib Include="osx" LibUrl="$(DuckDbArtifactRoot)/duckdb-binaries-osx.zip" InnerZipName="libduckdb-osx-universal.zip" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
</ItemGroup>
<MSBuild Projects="DownloadNativeLibs.targets" Properties="Rid=%(_NativeLib.Identity);LibUrl=%(_NativeLib.LibUrl);InnerZipName=%(_NativeLib.InnerZipName)" />
<MSBuild Projects="DownloadNativeLibs.targets" Properties="Rid=%(_NativeLib.Identity);LibUrl=%(_NativeLib.LibUrl);InnerZipName=%(_NativeLib.InnerZipName);NativeDownloadRetries=$(NativeDownloadRetries);NativeDownloadRetryDelayMilliseconds=$(NativeDownloadRetryDelayMilliseconds)" />
</Target>
<Target Name="CleanNativeLibs" BeforeTargets="Clean" Condition="'$(BuildType)' == 'Full' ">
<RemoveDir Directories="obj\runtimes" />
Expand Down
13 changes: 9 additions & 4 deletions DuckDB.NET.Bindings/DownloadNativeLibs.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project DefaultTargets="DownloadReleaseNatives;DownloadNightlyNatives">

<PropertyGroup>
<NativeDownloadRetries Condition="'$(NativeDownloadRetries)' == ''">5</NativeDownloadRetries>
<NativeDownloadRetryDelayMilliseconds Condition="'$(NativeDownloadRetryDelayMilliseconds)' == ''">1000</NativeDownloadRetryDelayMilliseconds>
</PropertyGroup>

<!-- Release: download lib zip directly -->
<Target Name="DownloadReleaseNatives"
Condition="!Exists('$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native') AND '$(InnerZipName)' == ''">
Expand All @@ -18,8 +23,8 @@
<DownloadFile
DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)"
SourceUrl="$(LibUrl)"
Retries="5"
RetryDelayMilliseconds="1000"
Retries="$(NativeDownloadRetries)"
RetryDelayMilliseconds="$(NativeDownloadRetryDelayMilliseconds)"
DestinationFileName="native.zip"
Condition="'$(LibIsUnc)' != 'True'"/>
<Unzip DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)\native"
Expand All @@ -39,8 +44,8 @@
<DownloadFile
DestinationFolder="$(MSBuildProjectDirectory)\obj\runtimes\$(Rid)"
SourceUrl="$(LibUrl)"
Retries="5"
RetryDelayMilliseconds="1000"
Retries="$(NativeDownloadRetries)"
RetryDelayMilliseconds="$(NativeDownloadRetryDelayMilliseconds)"
DestinationFileName="native.zip"/>
<Unzip DestinationFolder="$(TempExtractPath)"
SourceFiles="$(NativeZipPath)"/>
Expand Down
103 changes: 102 additions & 1 deletion DuckDB.NET.Bindings/DuckDBNativeObjects.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace DuckDB.NET.Native;
using System.ComponentModel;

namespace DuckDB.NET.Native;

public enum DuckDBState
{
Expand Down Expand Up @@ -249,4 +251,103 @@ public struct DuckDBQueryProgress
public double Percentage { get; }
public ulong RowsProcessed { get; }
public ulong TotalRowsToProcess { get; }
}

public enum DuckDBMetricType
{
// Core metrics
CpuTime = 2,
CumulativeCardinality = 4,
CumulativeRowsScanned = 7,
ExtraInfo = 3,
Latency = 11,
QueryName = 0,
ResultSetSize = 10,
[Description("Not available yet see(https://github.com/duckdb/duckdb/issues/22592)")]
RowsReturned = 12,
// Execution metrics
BlockedThreadTime = 1,
SystemPeakBufferMemory = 14,
SystemPeakTempDirSize = 15,
TotalMemoryAllocated = 91,
// File metrics
AttachLoadStorageLatency = 92,
AttachReplayWalLatency = 93,
CheckpointLatency = 94,
CommitLocalStorageLatency = 95,
TotalBytesRead = 16,
TotalBytesWritten = 17,
WaitingToAttachLatency = 96,
WalReplayEntryCount = 97,
WriteToWalLatency = 98,
// Operator metrics
OperatorCardinality = 6,
OperatorName = 13,
OperatorRowsScanned = 8,
OperatorTiming = 9,
OperatorType = 5,
// Optimizer metrics
OptimizerExpressionRewriter = 26,
OptimizerFilterPullup = 27,
OptimizerFilterPushdown = 28,
OptimizerEmptyResultPullup = 29,
OptimizerCteFilterPusher = 30,
OptimizerRegexRange = 31,
OptimizerInClause = 32,
OptimizerJoinOrder = 33,
OptimizerDeliminator = 34,
OptimizerUnnestRewriter = 35,
OptimizerUnusedColumns = 36,
OptimizerStatisticsPropagation = 37,
OptimizerCommonSubexpressions = 38,
OptimizerCommonAggregate = 39,
OptimizerColumnLifetime = 40,
OptimizerBuildSideProbeSide = 41,
OptimizerLimitPushdown = 42,
OptimizerTopN = 43,
OptimizerCompressedMaterialization = 44,
OptimizerDuplicateGroups = 45,
OptimizerReorderFilter = 46,
OptimizerSamplingPushdown = 47,
OptimizerJoinFilterPushdown = 48,
OptimizerExtension = 49,
OptimizerMaterializedCte = 50,
OptimizerSumRewriter = 51,
OptimizerLateMaterialization = 52,
OptimizerCteInlining = 53,
OptimizerRowGroupPruner = 54,
OptimizerTopNWindowElimination = 55,
OptimizerCommonSubplan = 56,
OptimizerJoinElimination = 57,
OptimizerWindowSelfJoin = 58,
// PhaseTiming metrics
AllOptimizers = 18,
CumulativeOptimizerTiming = 19,
PhysicalPlanner = 22,
PhysicalPlannerColumnBinding = 23,
PhysicalPlannerCreatePlan = 25,
PhysicalPlannerResolveTypes = 24,
Planner = 20,
PlannerBinding = 21
}

public enum DuckDBProfilingFormat
{
QueryTree,
Json,
QueryTreeOptimizer,
NoOutput
}

public enum DuckDBProfilingMode
{
Standard,
Detailed,
All
}

public enum DuckDBProfilingCoverage
{
Select,
All
}
35 changes: 34 additions & 1 deletion DuckDB.NET.Bindings/DuckDBWrapperObjects.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace DuckDB.NET.Native;
using System.Collections.Generic;

namespace DuckDB.NET.Native;

public class DuckDBDatabase() : SafeHandleZeroOrMinusOneIsInvalid(true)
{
Expand Down Expand Up @@ -59,6 +61,17 @@ protected override bool ReleaseHandle()
}
}

public class DuckDBProfilingInfo() : SafeHandleZeroOrMinusOneIsInvalid(true)
{
// No explicit destroy/free function for duckdb_profiling_info in the C API as of now.
// If DuckDB adds a destroy function in the future, call it here.
protected override bool ReleaseHandle()
{
// No-op: DuckDB does not require explicit destruction of profiling info handles.
return true;
}
}

public class DuckDBLogicalType() : SafeHandleZeroOrMinusOneIsInvalid(true)
{
protected override bool ReleaseHandle()
Expand Down Expand Up @@ -161,6 +174,25 @@ public T GetValue<T>()
static T Cast<TSource>(TSource value) => Unsafe.As<TSource, T>(ref value);
}

public Dictionary<TKey, TValue> GetMapValue<TKey, TValue>() where TKey : notnull
{
var result = new Dictionary<TKey, TValue>();

ulong entryCount = NativeMethods.Value.DuckDBGetMapSize(this);
for (ulong i = 0; i < entryCount; i++)
{
using var key = NativeMethods.Value.DuckDBGetMapKey(this, i);
using var value = NativeMethods.Value.DuckDBGetMapValue(this, i);

var keyValue = key.GetValue<TKey>();
var valueValue = value.GetValue<TValue>();

result.Add(keyValue, valueValue);
}

return result;
}

private DateTime GetTimestampValue(DuckDBTimestampStruct timestampStruct, DuckDBType duckDBType)
{
var additionalTicks = 0;
Expand Down Expand Up @@ -194,6 +226,7 @@ private DateTimeOffset GetTimeTzValue()
var timeTz = NativeMethods.DateTimeHelpers.DuckDBFromTimeTz(timeTzStruct);
return new DateTimeOffset(timeTz.Time.ToDateTime(), TimeSpan.FromSeconds(timeTz.Offset));
}

}

public class DuckDBClientContext() : SafeHandleZeroOrMinusOneIsInvalid(true)
Expand Down
31 changes: 31 additions & 0 deletions DuckDB.NET.Bindings/NativeMethods/NativeMethods.ProfilingInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

namespace DuckDB.NET.Native;

public partial class NativeMethods
{
//https://duckdb.org/docs/current/clients/c/api#profiling-info
public static partial class ProfilingInfo
{

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_get_profiling_info")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBProfilingInfo DuckDBGetProfilingInfo(DuckDBNativeConnection connection);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_profiling_info_get_value")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBProfilingInfoGetValue(DuckDBProfilingInfo info, [MarshalAs(UnmanagedType.LPStr)] string key);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_profiling_info_get_metrics")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBProfilingInfoGetMetrics(DuckDBProfilingInfo info);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_profiling_info_get_child_count")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial ulong DuckDBProfilingInfoGetChildCount(DuckDBProfilingInfo info);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_profiling_info_get_child")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBProfilingInfo DuckDBProfilingInfoGetChild(DuckDBProfilingInfo info, ulong index);

}
}
25 changes: 25 additions & 0 deletions DuckDB.NET.Bindings/NativeMethods/NativeMethods.Value.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ public static partial class Value
[return: MarshalUsing(typeof(DuckDBCallerOwnedStringMarshaller))]
public static partial string DuckDBGetVarchar(DuckDBValue value);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_get_map_size")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial ulong DuckDBGetMapSize(DuckDBValue value);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_get_map_key")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBGetMapKey(DuckDBValue value, ulong index);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_get_map_value")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBGetMapValue(DuckDBValue value, ulong index);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_create_list_value")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBCreateListValue(DuckDBLogicalType logicalType, IntPtr[] values, long count);
Expand All @@ -223,6 +235,10 @@ public static partial class Value
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBCreateArrayValue(DuckDBLogicalType logicalType, IntPtr[] values, long count);

[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_create_map_value")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial DuckDBValue DuckDBCreateMapValue(DuckDBLogicalType logicalType, IntPtr[] keys, IntPtr[] values, long count);

// Maybe [SuppressGCTransition]: new Value — one small allocation
[LibraryImport(DuckDbLibrary, EntryPoint = "duckdb_create_null_value")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
Expand Down Expand Up @@ -251,5 +267,14 @@ public static DuckDBValue DuckDBCreateArrayValue(DuckDBLogicalType logicalType,

return duckDBValue;
}

public static DuckDBValue DuckDBCreateMapValue(DuckDBLogicalType logicalType, DuckDBValue[] keys, DuckDBValue[] values, int count)
{
var duckDBValue = DuckDBCreateMapValue(logicalType, keys.Select(item => item.DangerousGetHandle()).ToArray(), values.Select(item => item.DangerousGetHandle()).ToArray(), count);

duckDBValue.SetChildValues([.. keys, .. values]);

return duckDBValue;
Comment thread
lucap-irion marked this conversation as resolved.
}
}
}
Loading
Loading