vbarua commented on code in PR #13118:
URL: https://github.com/apache/datafusion/pull/13118#discussion_r1819530216
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1058,6 +1065,65 @@ pub async fn from_substrait_rel(
partitioning_scheme,
}))
}
+ Some(RelType::Write(write)) => {
+ let table_name = match &write.write_type {
+ Some(WriteType::NamedTable(now)) =>
from_substrait_names(&now.names)?,
+ Some(WriteType::ExtensionTable(_)) => {
+ return not_impl_err!("Unsupported WriteType:
ExtensionTable");
+ }
+ _ => {
+ return plan_err!("No WriteType specified in WriteRel");
+ }
+ };
+
+ let table_schema = from_substrait_named_struct(
+ &write.table_schema.clone().unwrap(),
+ extensions,
+ )?;
+
+ let op = match write.op() {
+ write_rel::WriteOp::Insert =>
dml::WriteOp::Insert(dml::InsertOp::Append),
+ _ => {
+ return not_impl_err!("Unsupported WriteOp: {:?}",
write.op());
+ }
+ };
Review Comment:
minor/nit: if we move this up above `table_schema` we can avoid doing
redundant work in the event that his validation fails.
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -255,6 +257,27 @@ async fn except_rels(
Ok(rel)
}
+fn from_substrait_names(names: &[String]) -> Result<TableReference> {
Review Comment:
minor: I think it would be good to give this more specific name like
`table_reference_from_substrait_names`
--
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]