morrySnow commented on code in PR #29599:
URL: https://github.com/apache/doris/pull/29599#discussion_r1448239393
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/StructLiteral.java:
##########
@@ -42,19 +44,48 @@ public StructLiteral() {
}
public StructLiteral(List<Literal> fields) {
- super(computeDataType(fields));
- this.fields = ImmutableList.copyOf(fields);
+ this(fields, computeDataType(fields));
+ }
+
+ private StructLiteral(List<Literal> fields, DataType dataType) {
+ super(dataType);
+ this.fields = ImmutableList.copyOf(Objects.requireNonNull(fields,
"fields should not be null"));
+ Preconditions.checkArgument(dataType instanceof StructType,
+ "dataType should be StructType, but we meet %s", dataType);
+ Preconditions.checkArgument(fields.size() == ((StructType)
dataType).getFields().size(),
+ "fields size is not same with dataType size. %s vs %s",
+ fields.size(), ((StructType) dataType).getFields().size());
}
@Override
public List<Literal> getValue() {
return fields;
}
+ @Override
+ protected Expression uncheckedCastTo(DataType targetType) throws
AnalysisException {
Review Comment:
no
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]