@@ -618,6 +618,37 @@ private void ApplyDefaults()
618618 } ) ;
619619 }
620620
621+ /// <summary>
622+ /// Allow decimals with precision between 1 and 18 (inclusive) to be stored as integers.
623+ /// By default, this is DISABLED and all decimal types annotate fixed_len_byte_array.
624+ ///
625+ /// When enabled, the Parquet writer will use following physical types to store decimals:
626+ /// - int32: for precision between 1 and 9.
627+ /// - int64: for precision between 10 and 18.
628+ /// - fixed_len_byte_array: for precision > 18.
629+ ///
630+ /// As a consequence, decimal columns stored in integer types are more compact.
631+ /// </summary>
632+ public WriterPropertiesBuilder EnableStoreDecimalAsInteger ( )
633+ {
634+ ExceptionInfo . Check ( WriterPropertiesBuilder_Enable_Store_Decimal_As_Integer ( _handle . IntPtr ) ) ;
635+ GC . KeepAlive ( _handle ) ;
636+ return this ;
637+ }
638+
639+ /// <summary>
640+ /// Disable decimal logical type with precision between 1 and 18 (inclusive) to be stored
641+ /// as integer physical type.
642+ ///
643+ /// This is the default.
644+ /// </summary>
645+ public WriterPropertiesBuilder DisableStoreDecimalAsInteger ( )
646+ {
647+ ExceptionInfo . Check ( WriterPropertiesBuilder_Disable_Store_Decimal_As_Integer ( _handle . IntPtr ) ) ;
648+ GC . KeepAlive ( _handle ) ;
649+ return this ;
650+ }
651+
621652 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
622653 private static void OnDefaultProperty < T > ( T ? defaultPropertyValue , Action < T > setProperty )
623654 where T : struct
@@ -766,6 +797,12 @@ private static void OnDefaultRefProperty<T>(T? defaultPropertyValue, Action<T> s
766797 [ DllImport ( ParquetDll . Name ) ]
767798 private static extern IntPtr WriterPropertiesBuilder_Memory_Pool ( IntPtr builder , IntPtr memoryPool ) ;
768799
800+ [ DllImport ( ParquetDll . Name ) ]
801+ private static extern IntPtr WriterPropertiesBuilder_Enable_Store_Decimal_As_Integer ( IntPtr builder ) ;
802+
803+ [ DllImport ( ParquetDll . Name ) ]
804+ private static extern IntPtr WriterPropertiesBuilder_Disable_Store_Decimal_As_Integer ( IntPtr builder ) ;
805+
769806 private readonly ParquetHandle _handle ;
770807 }
771808}
0 commit comments