Ejemplo n.º 1
0
        ///
        public static Matrix ReadMatrix(IValuesReader reader)
        {
            var size       = reader.GetMatrixSize();
            var hasRead    = 0;
            var matrixRows = new List <MatrixRow>(size.Item1);
            var elements   = new List <int>(size.Item2);

            while (reader.HasNext())
            {
                var element = reader.ReadNext();
                elements.Add(element);
                ++hasRead;

                if (hasRead == size.Item2)
                {
                    matrixRows.Add(new MatrixRow {
                        Elements = elements.ToArray()
                    });
                    elements.Clear();
                    hasRead = 0;
                }
            }

            return(new Matrix {
                Rows = matrixRows.ToArray()
            });
        }
Ejemplo n.º 2
0
        public PColumn(Thrift.ColumnChunk thriftChunk, SchemaElement schema, Stream inputStream, ThriftStream thriftStream, ParquetOptions options)
        {
            _thriftChunk = thriftChunk;
            _thrift      = thriftStream;
            _schema      = schema;
            _inputStream = inputStream;
            _options     = options;

            _plainReader = new PlainValuesReader(options);
        }
        public PlainValuesReaderWriterTest()
        {
            _options = new ParquetOptions();

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

            _ms = new MemoryStream();
            _br = new BinaryReader(_ms);
            _bw = new BinaryWriter(_ms);
        }
Ejemplo n.º 4
0
        public PColumn(Thrift.ColumnChunk thriftChunk, Schema schema, Stream inputStream, ThriftStream thriftStream, ParquetOptions options)
        {
            if (thriftChunk.Meta_data.Path_in_schema.Count != 1)
            {
                throw new NotImplementedException("path in scheme is not flat");
            }

            _thriftChunk   = thriftChunk;
            _thrift        = thriftStream;
            _schema        = schema;
            _inputStream   = inputStream;
            _schemaElement = _schema[_thriftChunk];
            _options       = options;

            _plainReader = new PlainValuesReader(options);
        }