Пример #1
0
        /// <summary>
        /// Creates an instance from input stream
        /// </summary>
        /// <param name="input">Input stream, must be readable and seekable</param>
        /// <param name="formatOptions">Optional reader options</param>
        /// <param name="readerOptions">The reader options.</param>
        /// <exception cref="ArgumentNullException">input</exception>
        /// <exception cref="ArgumentException">stream must be readable and seekable - input</exception>
        /// <exception cref="IOException">not a Parquet file (size too small)</exception>
        public ParquetReader(Stream input, ParquetOptions formatOptions = null, ReaderOptions readerOptions = null) : base(input)
        {
            _input = input ?? throw new ArgumentNullException(nameof(input));
            if (!input.CanRead || !input.CanSeek)
            {
                throw new ArgumentException("stream must be readable and seekable", nameof(input));
            }
            if (_input.Length <= 8)
            {
                throw new IOException("not a Parquet file (size too small)");
            }

            ValidateFile();
            _formatOptions   = formatOptions ?? new ParquetOptions();
            _readerOptions   = readerOptions ?? new ReaderOptions();
            _fieldPredicates = PredicateFactory.CreateFieldPredicates(_readerOptions);
        }