incubator-doris [Bug] decimal value is not valid for definition

o2g1uqev  于 2022-04-22  发布在  Java
关注(0)|答案(1)|浏览(783)

Search before asking

  • I had searched in the issues and found no similar issues.

Version

0.15.0-rc4

What's Wrong?

I have a column which named F_B718ADEC73E04CE3EC720DD11A06A308 and data type is DECIMAL(20). When I insert 1152204005154225920 value ( the length is 19 ) into this column, Occur error 'Reason: decimal value is not valid for definition, column=F_B718ADEC73E04CE3EC720DD11A06A308, value=1152204005154225920, precision=20, scale=0. src line: [];’. How can i resolve it. Please help me! Thank you!

What You Expected?

The value 1152204005154225920 can insert into the column F_B718ADEC73E04CE3EC720DD11A06A308 ,which data type is DECIMAL(20)

How to Reproduce?

  • No response*

Anything Else?

  • No response*

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

oiopk7p5

oiopk7p51#

I look at the source code intablet_sink.cpp, I foud the checker which check maxValue and minValue of decimal if (dec_val > _max_decimalv2_val[i] || dec_val < _min_decimalv2_val[i]).

And I look at the source code in decimalv2_value.cpp, I found the max value of integer part is 999999999999999999 and the max value of fractional part is 999999999 .

But in the document define data type of DECIMAL is DECIMAL(M[,D]) 高精度定点数,M代表一共有多少个有效数字(precision),D代表小数点后最多有多少数字(scale) M的范围是[1,27], D的范围[1, 9], 另外,M必须要大于等于D的取值。默认的D取值为0

相关问题