Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decimal scale condition #504

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Parquet.Test/DecimalTypeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void Validate_Scale_Bigger_Then_Precision_Throws_Exception() {
const int precision = 3;
const int scale = 4;
ArgumentException ex = Assert.Throws<ArgumentException>(() => new DecimalDataField("field-name", precision, scale));
Assert.Equal("scale must be less than the precision (Parameter 'scale')", ex.Message);
Assert.Equal("scale must be less than or equal to the precision (Parameter 'scale')", ex.Message);
}
}
}
4 changes: 2 additions & 2 deletions src/Parquet/Schema/DecimalDataField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public DecimalDataField(string name,
throw new ArgumentException("precision is required and must be a non-zero positive integer", nameof(precision));
if(scale < 0)
throw new ArgumentException("scale must be zero or a positive integer", nameof(scale));
if(scale >= precision)
throw new ArgumentException("scale must be less than the precision", nameof(scale));
if(scale > precision)
throw new ArgumentException("scale must be less than or equal to the precision", nameof(scale));

Precision = precision;
Scale = scale;
Expand Down
Loading