コード例 #1
0
ファイル: ExceptionInfo.cs プロジェクト: ljubon/ParquetSharp
        public static TValue Return <TArg0, TValue>(ParquetHandle handle, TArg0 arg0, GetFunction <TArg0, TValue> getter)
        {
            var value = Return(handle.IntPtr, arg0, getter);

            GC.KeepAlive(handle);
            return(value);
        }
コード例 #2
0
ファイル: ColumnReader.cs プロジェクト: philjdf/ParquetSharp
 internal ColumnReader(ParquetHandle handle, RowGroupReader rowGroupReader, ColumnChunkMetaData columnChunkMetaData, int columnIndex)
 {
     Handle              = handle;
     RowGroupReader      = rowGroupReader;
     ColumnChunkMetaData = columnChunkMetaData;
     ColumnIndex         = columnIndex;
 }
コード例 #3
0
        public FileEncryptionPropertiesBuilder(byte[] footerKey)
        {
            var footerAesKey = new AesKey(footerKey);

            ExceptionInfo.Check(FileEncryptionPropertiesBuilder_Create(in footerAesKey, out var handle));
            _handle = new ParquetHandle(handle, FileEncryptionPropertiesBuilder_Free);
        }
コード例 #4
0
        internal static Statistics?Create(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            var parquetHandle = new ParquetHandle(handle, Statistics_Free);

            try
            {
                var type = ExceptionInfo.Return <PhysicalType>(handle, Statistics_Physical_Type);

                return(type switch
                {
                    PhysicalType.Boolean => new Statistics <bool>(parquetHandle),
                    PhysicalType.Int32 => new Statistics <int>(parquetHandle),
                    PhysicalType.Int64 => new Statistics <long>(parquetHandle),
                    PhysicalType.Int96 => new Statistics <Int96>(parquetHandle),
                    PhysicalType.Float => new Statistics <float>(parquetHandle),
                    PhysicalType.Double => new Statistics <double>(parquetHandle),
                    PhysicalType.ByteArray => new Statistics <ByteArray>(parquetHandle),
                    PhysicalType.FixedLenByteArray => new Statistics <FixedLenByteArray>(parquetHandle),
                    _ => throw new NotSupportedException($"Physical type {type} is not supported")
                });
            }
コード例 #5
0
ファイル: ExceptionInfo.cs プロジェクト: ljubon/ParquetSharp
        private static string ConvertPtrToString(ParquetHandle handle, Action <IntPtr>?deleter, IntPtr value)
        {
            var str = Marshal.PtrToStringAnsi(value);

            deleter?.Invoke(value);
            GC.KeepAlive(handle);
            return(str);
        }
コード例 #6
0
        public static string ReturnString(ParquetHandle handle, GetFunction <IntPtr> getter, Action <IntPtr> deleter = null)
        {
            Check(getter(handle.IntPtr, out var value));
            var str = Marshal.PtrToStringAnsi(value);

            deleter?.Invoke(value);
            GC.KeepAlive(handle);
            return(str);
        }
コード例 #7
0
        public ParquetFileReader(InputStream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException(nameof(inputStream));
            }

            _handle = new ParquetHandle(ExceptionInfo.Return <IntPtr>(inputStream.Handle, ParquetFileReader_Open), ParquetFileReader_Free);
        }
コード例 #8
0
        public ParquetFileReader(RandomAccessFile randomAccessFile)
        {
            if (randomAccessFile == null)
            {
                throw new ArgumentNullException(nameof(randomAccessFile));
            }

            _handle = new ParquetHandle(ExceptionInfo.Return <IntPtr>(randomAccessFile.Handle, ParquetFileReader_Open), ParquetFileReader_Free);
        }
コード例 #9
0
        public ParquetFileReader(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            ExceptionInfo.Check(ParquetFileReader_OpenFile(path, out var reader));
            _handle = new ParquetHandle(reader, ParquetFileReader_Free);
        }
コード例 #10
0
ファイル: Statistics.cs プロジェクト: yeskarthik/ParquetSharp
        internal static Statistics Create(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            var parquetHandle = new ParquetHandle(handle, Statistics_Free);

            try
            {
                var type = ExceptionInfo.Return <PhysicalType>(handle, Statistics_Physical_Type);

                switch (type)
                {
                case PhysicalType.Boolean:
                    return(new Statistics <bool>(parquetHandle));

                case PhysicalType.Int32:
                    return(new Statistics <int>(parquetHandle));

                case PhysicalType.Int64:
                    return(new Statistics <long>(parquetHandle));

                case PhysicalType.Int96:
                    return(new Statistics <Int96>(parquetHandle));

                case PhysicalType.Float:
                    return(new Statistics <float>(parquetHandle));

                case PhysicalType.Double:
                    return(new Statistics <double>(parquetHandle));

                case PhysicalType.ByteArray:
                    return(new Statistics <ByteArray>(parquetHandle));

                case PhysicalType.FixedLenByteArray:
                    return(new Statistics <FixedLenByteArray>(parquetHandle));

                default:
                    throw new NotSupportedException($"Physical type {type} is not supported");
                }
            }

            catch
            {
                parquetHandle.Dispose();
                throw;
            }
        }
コード例 #11
0
        public ParquetFileReader(RandomAccessFile randomAccessFile, ReaderProperties readerProperties)
        {
            if (randomAccessFile == null)
            {
                throw new ArgumentNullException(nameof(randomAccessFile));
            }
            if (readerProperties == null)
            {
                throw new ArgumentNullException(nameof(readerProperties));
            }

            _handle = new ParquetHandle(ExceptionInfo.Return <IntPtr, IntPtr>(randomAccessFile.Handle, readerProperties.Handle.IntPtr, ParquetFileReader_Open), ParquetFileReader_Free);

            GC.KeepAlive(readerProperties);
        }
コード例 #12
0
        public ParquetFileReader(string path, ReaderProperties readerProperties)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (readerProperties == null)
            {
                throw new ArgumentNullException(nameof(readerProperties));
            }

            ExceptionInfo.Check(ParquetFileReader_OpenFile(path, readerProperties.Handle.IntPtr, out var reader));
            _handle = new ParquetHandle(reader, ParquetFileReader_Free);

            GC.KeepAlive(readerProperties);
        }
コード例 #13
0
        internal static ColumnReader Create(IntPtr handle, ColumnChunkMetaData columnChunkMetaData)
        {
            var parquetHandle = new ParquetHandle(handle, ColumnReader_Free);

            try
            {
                var type = ExceptionInfo.Return <PhysicalType>(handle, ColumnReader_Type);

                switch (type)
                {
                case PhysicalType.Boolean:
                    return(new ColumnReader <bool>(parquetHandle, columnChunkMetaData));

                case PhysicalType.Int32:
                    return(new ColumnReader <int>(parquetHandle, columnChunkMetaData));

                case PhysicalType.Int64:
                    return(new ColumnReader <long>(parquetHandle, columnChunkMetaData));

                case PhysicalType.Int96:
                    return(new ColumnReader <Int96>(parquetHandle, columnChunkMetaData));

                case PhysicalType.Float:
                    return(new ColumnReader <float>(parquetHandle, columnChunkMetaData));

                case PhysicalType.Double:
                    return(new ColumnReader <double>(parquetHandle, columnChunkMetaData));

                case PhysicalType.ByteArray:
                    return(new ColumnReader <ByteArray>(parquetHandle, columnChunkMetaData));

                case PhysicalType.FixedLenByteArray:
                    return(new ColumnReader <FixedLenByteArray>(parquetHandle, columnChunkMetaData));

                default:
                    throw new NotSupportedException($"Physical type {type} is not supported");
                }
            }

            catch
            {
                parquetHandle.Dispose();
                throw;
            }
        }
コード例 #14
0
 public WriterPropertiesBuilder()
 {
     ExceptionInfo.Check(WriterPropertiesBuilder_Create(out var handle));
     _handle = new ParquetHandle(handle, WriterPropertiesBuilder_Free);
 }
コード例 #15
0
 internal ColumnReader(ParquetHandle handle, ColumnChunkMetaData columnChunkMetaData)
 {
     Handle = handle;
     ColumnChunkMetaData = columnChunkMetaData;
 }
コード例 #16
0
 public FileDecryptionPropertiesBuilder()
 {
     ExceptionInfo.Check(FileDecryptionPropertiesBuilder_Create(out var handle));
     _handle = new ParquetHandle(handle, FileDecryptionPropertiesBuilder_Free);
 }
コード例 #17
0
 internal ColumnChunkMetaData(IntPtr handle)
 {
     _handle = new ParquetHandle(handle, ColumnChunkMetaData_Free);
 }
コード例 #18
0
 internal FileDecryptionProperties(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, FileDecryptionProperties_Free);
 }
コード例 #19
0
ファイル: FileMetaData.cs プロジェクト: ljubon/ParquetSharp
 internal FileMetaData(IntPtr handle)
 {
     _handle = new ParquetHandle(handle, FileMetaData_Free);
 }
コード例 #20
0
 internal ReaderProperties(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, ReaderProperties_Free);
 }
コード例 #21
0
 public KeyValueMetadata(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, KeyValueMetadata_Free);
 }
コード例 #22
0
 protected LogicalType(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, LogicalType_Free);
 }
コード例 #23
0
 public ParquetFileReader(InputStream inputStream)
 {
     ExceptionInfo.Check(ParquetFileReader_Open(inputStream.Handle, out var reader));
     GC.KeepAlive(inputStream);
     _handle = new ParquetHandle(reader, ParquetFileReader_Free);
 }
コード例 #24
0
 internal WriterProperties(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, WriterProperties_Free);
 }
コード例 #25
0
 internal RowGroupReader(IntPtr handle)
 {
     _handle = new ParquetHandle(handle, RowGroupReader_Free);
 }
コード例 #26
0
 internal RowGroupReader(IntPtr handle, ParquetFileReader parquetFileReader)
 {
     _handle           = new ParquetHandle(handle, RowGroupReader_Free);
     ParquetFileReader = parquetFileReader;
 }
コード例 #27
0
 public ParquetFileReader(string path)
 {
     ExceptionInfo.Check(ParquetFileReader_OpenFile(path, out var reader));
     _handle = new ParquetHandle(reader, ParquetFileReader_Free);
 }
コード例 #28
0
ファイル: ExceptionInfo.cs プロジェクト: ljubon/ParquetSharp
 public static string ReturnString(ParquetHandle handle, GetFunction <IntPtr> getter, Action <IntPtr>?deleter = null)
 {
     Check(getter(handle.IntPtr, out var value));
     return(ConvertPtrToString(handle, deleter, value));
 }
コード例 #29
0
 internal ColumnDecryptionPropertiesBuilder(IntPtr handle)
 {
     _handle = new ParquetHandle(handle, ColumnDecryptionPropertiesBuilder_Free);
 }
コード例 #30
0
 internal ColumnEncryptionProperties(IntPtr handle)
 {
     Handle = new ParquetHandle(handle, ColumnEncryptionProperties_Free);
 }