Skip to content
Merged
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
5 changes: 5 additions & 0 deletions cpp/WriterPropertiesBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,9 @@ extern "C"
{
TRYCATCH(builder->disable_store_decimal_as_integer();)
}

PARQUETSHARP_EXPORT ExceptionInfo* WriterPropertiesBuilder_Set_Max_Statistics_Size(WriterProperties::Builder* builder, size_t max_statistics_size)
{
TRYCATCH(builder->max_statistics_size(max_statistics_size);)
}
}
3 changes: 3 additions & 0 deletions csharp.test/TestWriterProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static void TestDefaultProperties()
Assert.False(p.PageChecksumEnabled);
Assert.That(p.MemoryPool.BackendName, Is.Not.Empty);
Assert.False(p.StoreDecimalAsInteger);
Assert.AreEqual(4096, p.MaxStatisticsSize(new ColumnPath("anypath")));
}

[Test]
Expand All @@ -48,6 +49,7 @@ public static void TestPropertiesBuilder()
.EnablePageChecksum()
.MemoryPool(MemoryPool.SystemMemoryPool())
.EnableStoreDecimalAsInteger()
.SetMaxStatisticsSize(512)
.Build();

Assert.AreEqual("Meeeee!!!", p.CreatedBy);
Expand All @@ -64,6 +66,7 @@ public static void TestPropertiesBuilder()
Assert.True(p.PageChecksumEnabled);
Assert.AreEqual("system", p.MemoryPool.BackendName);
Assert.True(p.StoreDecimalAsInteger);
Assert.AreEqual(512, p.MaxStatisticsSize(new ColumnPath("anypath")));
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions csharp/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ ParquetSharp.ReaderProperties.SetFooterReadSize(long size) -> void
ParquetSharp.WriterProperties.StoreDecimalAsInteger.get -> bool
ParquetSharp.WriterPropertiesBuilder.EnableStoreDecimalAsInteger() -> ParquetSharp.WriterPropertiesBuilder!
ParquetSharp.WriterPropertiesBuilder.DisableStoreDecimalAsInteger() -> ParquetSharp.WriterPropertiesBuilder!
ParquetSharp.WriterPropertiesBuilder.SetMaxStatisticsSize(ulong maxStatisticsSize) -> ParquetSharp.WriterPropertiesBuilder!
2 changes: 1 addition & 1 deletion csharp/WriterProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public SortingColumn[] SortingColumns()
private static extern IntPtr WriterProperties_Statistics_Enabled(IntPtr writerProperties, IntPtr path, [MarshalAs(UnmanagedType.I1)] out bool enabled);

[DllImport(ParquetDll.Name)]
private static extern IntPtr WriterProperties_Max_Statistics_Size(IntPtr writerProperties, IntPtr path, [MarshalAs(UnmanagedType.I1)] out ulong maxStatisticsSize);
private static extern IntPtr WriterProperties_Max_Statistics_Size(IntPtr writerProperties, IntPtr path, out ulong maxStatisticsSize);

[DllImport(ParquetDll.Name)]
private static extern IntPtr WriterProperties_Sorting_Columns(IntPtr writerProperties, ref IntPtr columnIndices, ref IntPtr descending, ref IntPtr nullsFirst, ref int numColumns);
Expand Down
16 changes: 16 additions & 0 deletions csharp/WriterPropertiesBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,19 @@ public WriterPropertiesBuilder MemoryPool(MemoryPool memoryPool)
return this;
}

/// <summary>
/// Specify the maximum size in bytes for minimum and maximum values in page and column chunk statistics.
/// Default 4 KiB.
/// </summary>
/// <param name="maxStatisticsSize">The max statistics size in bytes</param>
/// <returns>This builder instance.</returns>
public WriterPropertiesBuilder SetMaxStatisticsSize(ulong maxStatisticsSize)
{
ExceptionInfo.Check(WriterPropertiesBuilder_Set_Max_Statistics_Size(_handle.IntPtr, maxStatisticsSize));
GC.KeepAlive(_handle);
return this;
}

private void ApplyDefaults()
{
OnDefaultProperty(DefaultWriterProperties.EnableDictionary, enabled =>
Expand Down Expand Up @@ -803,6 +816,9 @@ private static void OnDefaultRefProperty<T>(T? defaultPropertyValue, Action<T> s
[DllImport(ParquetDll.Name)]
private static extern IntPtr WriterPropertiesBuilder_Disable_Store_Decimal_As_Integer(IntPtr builder);

[DllImport(ParquetDll.Name)]
private static extern IntPtr WriterPropertiesBuilder_Set_Max_Statistics_Size(IntPtr builder, ulong maxStatisticsSize);

private readonly ParquetHandle _handle;
}
}