Esempio n. 1
0
        private void DisposeWriters()
        {
            if (_writers != null)
            {
                foreach (IColumnWriter writer in _writers)
                {
                    if (writer != null)
                    {
                        writer.Dispose();
                    }
                }

                _writers = null;

                // Write the schema and query only if the table was valid
                if (Metadata.RowCount > 0)
                {
                    // Write table metadata for the completed table
                    TableMetadataSerializer.Write(_xDatabaseContext.StreamProvider, _tableRootPath, Metadata);

                    // On Dispose, tell the StreamProvider to publish the table
                    _xDatabaseContext.StreamProvider.Publish(_tableRootPath);
                }
            }
        }
Esempio n. 2
0
        private BinaryTableReader(IStreamProvider streamProvider, string tableRootPath)
        {
            TablePath = tableRootPath;
            _metadata = TableMetadataSerializer.Read(streamProvider, tableRootPath);

            // Construct columns (files aren't opened until columns are subscribed to)
            _columns = new BinaryReaderColumn[_metadata.Schema.Count];
            for (int i = 0; i < _columns.Length; ++i)
            {
                _columns[i] = new BinaryReaderColumn(this, _metadata.Schema[i], streamProvider);
            }

            Reset();
        }
Esempio n. 3
0
        public static IXTable Build(IStreamProvider streamProvider, string tableRootPath)
        {
            TableMetadata metadata = TableMetadataSerializer.Read(streamProvider, tableRootPath);

            if (metadata.Partitions.Count > 0)
            {
                // If this table has partitions, load the parts (*allowing* recursive partitioning)
                // This allows partitioning by a column where one column value still will hit the size limit.
                return(ConcatenatedTable.Build(metadata.Partitions.Select((partition) => BinaryTableReader.Build(streamProvider, Path.Combine(tableRootPath, partition)))));
            }
            else
            {
                return(new BinaryTableReader(streamProvider, tableRootPath));
            }
        }
Esempio n. 4
0
        private void DisposeWriters()
        {
            if (_partitionWriter != null)
            {
                _metadata.Schema = _partitionWriter.Metadata.Schema;

                _partitionWriter.Dispose();
                _partitionWriter = null;
            }

            // Write the schema and query only if the table was valid
            if (_metadata.RowCount > 0)
            {
                // Write table metadata for the partition set
                TableMetadataSerializer.Write(_xDatabaseContext.StreamProvider, _tableRootPath, _metadata);

                // On Dispose, tell the StreamProvider to publish the table
                _xDatabaseContext.StreamProvider.Publish(_tableRootPath);
            }
        }