[branch-2.1][fix](default value) Avoid default precision value of 0 for default expressions during deserialization (#40806)

pick  (#40671)

This PR fixes the issue where the precision of default value expressions
was incorrectly set to `0` during deserialization. The `gsonPostProcess`
method no longer assigns a default precision of `0` if the precision is
not provided. Additionally, logic has been added to ensure that
expressions without precision do not incorrectly apply a precision of
`0`.
This commit is contained in:
zy-kkk
2024-09-13 19:59:12 +08:00
committed by GitHub
parent 873f70c262
commit 9e8e1dac4e

View File

@ -64,7 +64,7 @@ public class DefaultValueExprDef implements Writable, GsonPostProcessable {
*/
public FunctionCallExpr getExpr(Type type) {
List<Expr> exprs = null;
if (precision != null) {
if (precision != null && precision != 0) {
exprs = Lists.newArrayList();
exprs.add(new IntLiteral(precision));
}
@ -101,8 +101,6 @@ public class DefaultValueExprDef implements Writable, GsonPostProcessable {
@Override
public void gsonPostProcess() throws IOException {
if (precision == null) {
precision = 0L;
}
// nothing to do
}
}