private void NextPartitionWriter() { if (_partitionWriter != null) { _partitionWriter.Dispose(); } string nextPartitionId = _metadata.Partitions.Count.ToString(); _partitionWriter = BinaryTableWriter.BuildPartition(_source, _xDatabaseContext, Path.Combine(_tableRootPath, nextPartitionId)); _metadata.Partitions.Add(nextPartitionId); }
public IXTable Build(IXTable source, XDatabaseContext context) { string filePath = context.Parser.NextOutputTableName(); if (filePath.StartsWith("Table\\", StringComparison.OrdinalIgnoreCase) || filePath.EndsWith(".xform", StringComparison.OrdinalIgnoreCase)) { return(BinaryTableWriter.Build(source, context, filePath)); } else { return(new TabularFileWriter(source, context.StreamProvider, filePath)); } }
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); } }