[fix](struct-type) fix struct subtype support (#17081)

1. Make sure all sub types which STRUCT supported work correctly;
2. remove unused variable `_need_validate_data`;
3. lazy init min or max decimal to support nested DecimalV2 column validate;

Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
This commit is contained in:
camby
2023-02-28 11:37:07 +08:00
committed by GitHub
parent 1771d1e5e7
commit 4d8b310de0
5 changed files with 129 additions and 38 deletions

View File

@ -43,7 +43,7 @@ public class StructLiteral extends LiteralExpr {
type = new StructType();
children = new ArrayList<>();
for (LiteralExpr expr : exprs) {
if (!type.supportSubType(expr.getType())) {
if (!expr.getType().isNull() && !type.supportSubType(expr.getType())) {
throw new AnalysisException("Invalid element type in STRUCT.");
}
((StructType) type).addField(new StructField(expr.getType()));