2929
3030#include " common/status.h"
3131#include " core/data_type/data_type.h"
32+ #include " core/data_type/data_type_nullable.h"
3233#include " core/data_type/define_primitive_type.h"
3334#include " core/data_type_serde/data_type_array_serde.h"
3435#include " core/data_type_serde/data_type_serde.h"
@@ -47,7 +48,8 @@ namespace doris {
4748class DataTypeArray final : public IDataType {
4849private:
4950 // / The type of array elements.
50- DataTypePtr nested;
51+ DataTypeNullablePtr nested;
52+ DataTypePtr nested_as_base;
5153
5254public:
5355 static constexpr PrimitiveType PType = TYPE_ARRAY;
@@ -79,7 +81,8 @@ class DataTypeArray final : public IDataType {
7981
8082 bool equals (const IDataType& rhs) const override ;
8183
82- const DataTypePtr& get_nested_type () const { return nested; }
84+ const DataTypePtr& get_nested_type () const { return nested_as_base; }
85+ const DataTypeNullablePtr& get_nullable_nested_type () const { return nested; }
8386
8487 // / 1 for plain array, 2 for array of arrays and so on.
8588 size_t get_number_of_dimensions () const ;
@@ -99,15 +102,15 @@ class DataTypeArray final : public IDataType {
99102 void to_protobuf (PTypeDesc* ptype, PTypeNode* node, PScalarType* scalar_type) const override {
100103 node->set_type (TTypeNodeType::ARRAY);
101104 node->set_contains_null (nested->is_nullable ());
102- nested ->to_protobuf (ptype);
105+ get_nested_type () ->to_protobuf (ptype);
103106 }
104107
105108#ifdef BE_TEST
106109 void to_thrift (TTypeDesc& thrift_type, TTypeNode& node) const override {
107110 node.type = TTypeNodeType::ARRAY;
108111 node.__isset .contains_nulls = true ;
109112 node.contains_nulls .push_back (nested->is_nullable ());
110- nested ->to_thrift (thrift_type);
113+ get_nested_type () ->to_thrift (thrift_type);
111114 }
112115#endif
113116};
0 commit comments