AppendData Logical Command¶
AppendData is a V2WriteCommand that represents appending data (the result of executing a structured query) to a table (with the columns matching by name or position).
Creating Instance¶
AppendData takes the following to be created:
- NamedRelation for the table (to append data to)
- Query (LogicalPlan)
- Write Options (
Map[String, String]) - isByName flag
- Write
AppendData is created using byName and byPosition operators.
isByName flag¶
AppendData is given isByName flag when created:
- byName with the flag enabled (
true) - byPosition with the flag disabled (
false)
isByName is part of the V2WriteCommand abstraction.
byName¶
byName(
table: NamedRelation,
df: LogicalPlan,
writeOptions: Map[String, String] = Map.empty): AppendData
byName creates a AppendData with the isByName flag enabled (true).
byName is used when:
DataFrameWriteris requested to saveInternal (withSaveMode.Appendmode) and saveAsTable (withSaveMode.Appendmode)DataFrameWriterV2is requested to append
byPosition¶
byPosition(
table: NamedRelation,
query: LogicalPlan,
writeOptions: Map[String, String] = Map.empty): AppendData
byPosition creates a AppendData with the isByName flag disabled (false).
byPosition is used when:
- ResolveInsertInto logical resolution rule is executed
DataFrameWriteris requested to insertInto
Execution Planning¶
AppendData is planned as one of the physical operators by DataSourceV2Strategy execution planning strategy:
AppendDataExecV1AppendDataExec