forked from aloneguid/parquet-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapplying changes for aloneguid#252 after rebasing with current
- Loading branch information
Showing
3 changed files
with
115 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Parquet.Data; | ||
using Parquet.File; | ||
using Parquet.Schema; | ||
using Xunit; | ||
|
||
namespace Parquet.Test { | ||
public class ParquetRowGroupReaderTest : TestBase { | ||
|
||
[Theory] | ||
[InlineData("multi.page.parquet")] | ||
[InlineData("multi.page.v2.parquet")] | ||
public async Task GetColumnStatistics_ShouldNotBeEmpty(string parquetFile) { | ||
using(ParquetReader reader = await ParquetReader.CreateAsync(OpenTestFile(parquetFile), leaveStreamOpen: false)) { | ||
for(int gidx = 0; gidx < reader.RowGroupCount; gidx++) { | ||
using(ParquetRowGroupReader rowGroupReader = reader.OpenRowGroupReader(0)) { | ||
|
||
foreach(DataField df in reader.Schema.DataFields) { | ||
DataColumnReader columnReader = rowGroupReader.GetColumnReader(df); | ||
DataColumnStatistics? stats = columnReader.GetColumnStatistics(); | ||
|
||
Assert.NotNull(stats); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
[Theory] | ||
[InlineData("multi.page.parquet")] | ||
[InlineData("multi.page.v2.parquet")] | ||
public async Task GetColumnReader_MustFailOnInvalidField(string parquetFile) { | ||
using(ParquetReader reader = await ParquetReader.CreateAsync(OpenTestFile(parquetFile), leaveStreamOpen: false)) { | ||
using(ParquetRowGroupReader rowGroupReader = reader.OpenRowGroupReader(0)) { | ||
|
||
Assert.Throws<ArgumentNullException>(() => rowGroupReader.GetColumnReader(null!)); | ||
DataField nonExistingField = new DataField("non_existing_field7862425", typeof(int)); | ||
Assert.Throws<ParquetException>(() => rowGroupReader.GetColumnReader(nonExistingField)); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters