Skip to content

Commit 97a8408

Browse files
committed
maybe fix build
1 parent be272ec commit 97a8408

File tree

4 files changed

+50
-5
lines changed

4 files changed

+50
-5
lines changed

datafusion/proto/proto/datafusion.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ message PrepareNode {
181181
string name = 1;
182182
repeated datafusion_common.ArrowType data_types = 2;
183183
LogicalPlanNode input = 3;
184+
repeated datafusion_common.Field fields = 4;
184185
}
185186

186187
message CreateCatalogSchemaNode {

datafusion/proto/src/generated/pbjson.rs

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/proto/src/generated/prost.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/proto/src/logical_plan/mod.rs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::{
3333
};
3434

3535
use crate::protobuf::{proto_error, ToProtoError};
36-
use arrow::datatypes::{DataType, Schema, SchemaBuilder, SchemaRef};
36+
use arrow::datatypes::{DataType, Field, Schema, SchemaBuilder, SchemaRef};
3737
use datafusion::datasource::cte_worktable::CteWorkTable;
3838
use datafusion::datasource::file_format::arrow::ArrowFormat;
3939
#[cfg(feature = "avro")]
@@ -888,9 +888,30 @@ impl AsLogicalPlan for LogicalPlanNode {
888888
.iter()
889889
.map(DataType::try_from)
890890
.collect::<Result<_, _>>()?;
891-
LogicalPlanBuilder::from(input)
892-
.prepare(prepare.name.clone(), data_types)?
893-
.build()
891+
let fields: Vec<Field> = prepare
892+
.fields
893+
.iter()
894+
.map(Field::try_from)
895+
.collect::<Result<_, _>>()?;
896+
897+
if fields.is_empty() {
898+
LogicalPlanBuilder::from(input)
899+
.prepare(
900+
prepare.name.clone(),
901+
data_types
902+
.into_iter()
903+
.map(|dt| Field::new("", dt, true).into())
904+
.collect(),
905+
)?
906+
.build()
907+
} else {
908+
LogicalPlanBuilder::from(input)
909+
.prepare(
910+
prepare.name.clone(),
911+
fields.into_iter().map(|f| f.into()).collect(),
912+
)?
913+
.build()
914+
}
894915
}
895916
LogicalPlanType::DropView(dropview) => {
896917
Ok(LogicalPlan::Ddl(DdlStatement::DropView(DropView {
@@ -1632,9 +1653,13 @@ impl AsLogicalPlan for LogicalPlanNode {
16321653
name: name.clone(),
16331654
data_types: data_types
16341655
.iter()
1635-
.map(|t| t.try_into())
1656+
.map(|t| t.data_type().try_into())
16361657
.collect::<Result<Vec<_>, _>>()?,
16371658
input: Some(Box::new(input)),
1659+
fields: data_types
1660+
.iter()
1661+
.map(|f| f.as_ref().try_into())
1662+
.collect::<Result<Vec<_>, _>>()?,
16381663
},
16391664
))),
16401665
})

0 commit comments

Comments
 (0)