Closed drmingdrmer closed 4 months ago
/take
database
and table
not only used for display. get_table
and validate_table_access
and HookOperator::create
also need them, so I think we do not need remove them.
cc @drmingdrmer
Thank you for investigating this issue. It seems addressing it is not as straightforward as initially anticipated.
I'm gonna spend more time to see why database
and table
are used more than expected.
When building an
Insert
plan:The table is fetched here:
https://github.com/datafuselabs/databend/blob/a4fb4f7973c3ceacb8f67fcb57c0f1cc9f0d52d6/src/query/sql/src/planner/binder/insert.rs#L93-L96
And
TableInfo
can be fetch withtable.get_table_info()
. AndTableInof.desc
is in form of<database>.<table>
. Thus there is no need to keep fielddatabase
andtable
in planInsert
, sincedatabase
andtable
are only used for display, and can be replace withTableInfo.desc
.https://github.com/datafuselabs/databend/blob/a4fb4f7973c3ceacb8f67fcb57c0f1cc9f0d52d6/src/query/sql/src/planner/binder/insert.rs#L192-L200
And
Insert::table_info
does not have to be anOption
anymore.