Ejemplo n.º 1
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);

                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;
            }
        }
Ejemplo n.º 2
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;
            }
        }