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

Decimal types with scale > 28 cannot be read #230

Closed
MaceWindu opened this issue Nov 19, 2022 · 2 comments
Closed

Decimal types with scale > 28 cannot be read #230

MaceWindu opened this issue Nov 19, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@MaceWindu
Copy link

Sample type Decimal(38, 29)
Exponent calculated using decimal type and fails with overflow here: https://github.com/DarkWanderer/ClickHouse.Client/blob/master/ClickHouse.Client/Types/DecimalType.cs#L26

   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at System.Decimal.op_Multiply(Decimal d1, Decimal d2)
   at ClickHouse.Client.Utility.MathUtils.ToPower(Decimal value, Int32 power) in D:\a\ClickHouse.Client\ClickHouse.Client\ClickHouse.Client\Utility\MathUtils.cs:line 40
ClickHouse.Client.dll!ClickHouse.Client.Utility.MathUtils.ToPower(decimal value, int power) Line 40
ClickHouse.Client.dll!ClickHouse.Client.Types.DecimalType.Scale.set(int value) Line 26
ClickHouse.Client.dll!ClickHouse.Client.Types.DecimalType.Parse(ClickHouse.Client.Types.Grammar.SyntaxTreeNode node, System.Func<ClickHouse.Client.Types.Grammar.SyntaxTreeNode, ClickHouse.Client.Types.ClickHouseType> parseClickHouseTypeFunc, ClickHouse.Client.TypeSettings settings) Line 62
ClickHouse.Client.dll!ClickHouse.Client.Types.TypeConverter.ParseClickHouseType(ClickHouse.Client.Types.Grammar.SyntaxTreeNode node, ClickHouse.Client.TypeSettings settings) Line 131
ClickHouse.Client.dll!ClickHouse.Client.Types.TypeConverter.ParseClickHouseType(string type, ClickHouse.Client.TypeSettings settings) Line 119
ClickHouse.Client.dll!ClickHouse.Client.ADO.Readers.ClickHouseDataReader.ReadHeaders() Line 215
ClickHouse.Client.dll!ClickHouse.Client.ADO.Readers.ClickHouseDataReader.ClickHouseDataReader(System.Net.Http.HttpResponseMessage httpResponse, ClickHouse.Client.TypeSettings settings) Line 35
ClickHouse.Client.dll!ClickHouse.Client.ADO.ClickHouseCommand.ExecuteDbDataReaderAsync(System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken) Line 142
@DarkWanderer
Copy link
Owner

Thanks for report. Should be fixed in 6.2.0

@MaceWindu
Copy link
Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants