We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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(64, 16) public static void main(String[] args) { byte[] bytes = new byte[] {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; LogBuffer logBuffer = new LogBuffer(bytes, 0, bytes.length); BigDecimal decimal = logBuffer.getDecimal(64, 16); System.out.println(decimal.toPlainString()); }
预期输出:"0.0000000000000000" (16个0)
实际输出:"0.000000000" (9个0)
错误原因:解析最后一段小数的时候,没有补齐0至原始数据类型定义的小数精度
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
Line 1546 in 66483ef
修复方案:补齐指定scale后的0
for (int i = pos - mark; i < frac; i++) { buf[pos++] = ('0'); }
MySQL 源码中最后也有补齐0的操作: // Append padding if a fixed precision was specified. for (int i = 0; i < fill; ++i) *to++ = '0';
MySQL 源码中最后也有补齐0的操作:
// Append padding if a fixed precision was specified. for (int i = 0; i < fill; ++i) *to++ = '0';
The text was updated successfully, but these errors were encountered:
No branches or pull requests
复现方式:
预期输出:"0.0000000000000000" (16个0)
实际输出:"0.000000000" (9个0)
错误原因:解析最后一段小数的时候,没有补齐0至原始数据类型定义的小数精度
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
Line 1546 in 66483ef
修复方案:补齐指定scale后的0
The text was updated successfully, but these errors were encountered: