incubator-doris Create FieldList to reuse filed and schema

omtl5h9j  于 2022-04-22  发布在  Java
关注(0)|答案(1)|浏览(288)

Now in our storage engine, we create so many Schema/Field for many purpose. I think after a table is created, its Schema and Filed are not modified unless there is a schema change. However, schema change for a table is infrequent operation, which means that Schema/Field will keep the same most time. So, I think we can reuse this Schema/Field to avoid unnecessary object creation and deletion.

To achieve this, I will create a FieldList struct and keep it in tablet. When tablet's schema is changed, we will create a new FieldList. For safety I will store it in shared_ptr, when old is invalidated in tablet, others can still use the old one.

And Schema will contain one FiledList to reuse this struct. If only some fields are used, then column ids of used columns and FiledList can build Schema.

相关问题