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)); } }
/// <summary> /// Recursively extract each non-ConcatenatedTable source from a list of sources. /// </summary> /// <param name="source">IXTable to add</param> private static IEnumerable <IXTable> DirectSources(IEnumerable <IXTable> sources) { foreach (IXTable source in sources) { ConcatenatedTable cSource = source as ConcatenatedTable; if (cSource == null) { yield return(source); } else { foreach (IXTable inner in DirectSources(cSource.Sources)) { yield return(inner); } } } }