Exemple #1
0
        /// <summary>
        /// Finalizes file, writes metadata and footer
        /// </summary>
        public void Dispose()
        {
            if (!_dataWritten)
            {
                return;
            }

            //finalize file
            long size = ThriftStream.Write(_meta.ThriftMeta);

            //metadata size
            Writer.Write((int)size); //4 bytes

            //end magic
            WriteMagic();           //4 bytes

            Writer.Flush();
            Stream.Flush();
        }
Exemple #2
0
        internal ParquetRowGroupWriter(Schema schema,
                                       Stream stream,
                                       ThriftStream thriftStream,
                                       ThriftFooter footer,
                                       CompressionMethod compressionMethod,
                                       int compressionLevel,
                                       ParquetOptions formatOptions)
        {
            _schema            = schema ?? throw new ArgumentNullException(nameof(schema));
            _stream            = stream ?? throw new ArgumentNullException(nameof(stream));
            _thriftStream      = thriftStream ?? throw new ArgumentNullException(nameof(thriftStream));
            _footer            = footer ?? throw new ArgumentNullException(nameof(footer));
            _compressionMethod = compressionMethod;
            _compressionLevel  = compressionLevel;
            _formatOptions     = formatOptions;

            _thriftRowGroup         = _footer.AddRowGroup();
            _rgStartPos             = _stream.Position;
            _thriftRowGroup.Columns = new List <Thrift.ColumnChunk>();
            _thschema = _footer.GetWriteableSchema();
        }