public PlainValuesReaderWriterTest()
        {
            _options = new ParquetOptions();

            _reader = new PlainValuesReader(_options);
            _writer = new PlainValuesWriter(_options);

            _ms = new MemoryStream();
            _br = new BinaryReader(_ms);
            _bw = new BinaryWriter(_ms);
        }
        /// <summary>
        /// Creates an instance of parquet writer on top of a stream
        /// </summary>
        /// <param name="output">Writeable, seekable stream</param>
        /// <param name="formatOptions">Additional options</param>
        /// <param name="writerOptions">The writer options.</param>
        /// <exception cref="ArgumentNullException">Output is null.</exception>
        /// <exception cref="ArgumentException">Output stream is not writeable</exception>
        public ParquetWriter(Stream output, ParquetOptions formatOptions = null, WriterOptions writerOptions = null) : base(output)
        {
            _output = output ?? throw new ArgumentNullException(nameof(output));
            if (!output.CanWrite)
            {
                throw new ArgumentException("stream is not writeable", nameof(output));
            }
            _formatOptions = formatOptions ?? new ParquetOptions();
            _writerOptions = writerOptions ?? new WriterOptions();
            _meta          = new FileMetadataBuilder(_writerOptions);

            _plainWriter = new PlainValuesWriter(_formatOptions);
            _rleWriter   = new RunLengthBitPackingHybridValuesWriter();
            _dicWriter   = new PlainDictionaryValuesWriter(_rleWriter);
        }
Beispiel #3
0
 public ColumnWriter(Stream output, ThriftStream thriftStream,
                     FileMetadataBuilder builder, SchemaElement schema,
                     CompressionMethod compressionMethod,
                     ParquetOptions formatOptions,
                     WriterOptions writerOptions)
 {
     _output            = output;
     _thriftStream      = thriftStream;
     _meta              = builder;
     _schema            = schema;
     _compressionMethod = compressionMethod;
     _formatOptions     = formatOptions;
     _writerOptions     = writerOptions;
     _plainWriter       = new PlainValuesWriter(formatOptions);
     _rleWriter         = new RunLengthBitPackingHybridValuesWriter();
     _dicWriter         = new PlainDictionaryValuesWriter(_rleWriter);
 }
        /// <summary>
        /// Creates an instance of parquet writer on top of a stream
        /// </summary>
        /// <param name="output">Writeable, seekable stream</param>
        /// <param name="options">Additional options</param>
        public ParquetWriter(Stream output, ParquetOptions options = null)
        {
            _output = output ?? throw new ArgumentNullException(nameof(output));
            if (!output.CanWrite)
            {
                throw new ArgumentException("stream is not writeable", nameof(output));
            }
            _thrift  = new ThriftStream(output);
            _writer  = new BinaryWriter(_output);
            _options = options ?? new ParquetOptions();

            _plainWriter = new PlainValuesWriter(_options);
            _rleWriter   = new RunLengthBitPackingHybridValuesWriter();

            //file starts with magic
            WriteMagic();
        }
 public PlainDictionaryValuesWriter(IValuesWriter rleWriter)
 {
     _rleWriter = rleWriter ?? throw new ArgumentNullException(nameof(rleWriter));
 }