[ 
https://issues.apache.org/jira/browse/ARROW-8197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17065997#comment-17065997
 ] 

Andy Grove commented on ARROW-8197:
-----------------------------------

We should probably pass the name into the Column::new() in this code, since the 
name is available at this time. Note that we probably don't yet have validation 
to ensure that all fields in a schema are unique? If not, we should add that as 
well.
{code:java}
/// Create a physical expression from a logical expression
pub fn create_physical_expr(
    &self,
    e: &Expr,
    input_schema: &Schema,
) -> Result<Arc<dyn PhysicalExpr>> {
    match e {
        Expr::Column(i) => Ok(Arc::new(Column::new(*i))), {code}

> [Rust] DataFusion "create_physical_plan" returns incorrect schema?
> ------------------------------------------------------------------
>
>                 Key: ARROW-8197
>                 URL: https://issues.apache.org/jira/browse/ARROW-8197
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust, Rust - DataFusion
>    Affects Versions: 0.15.1
>            Reporter: Paddy Horan
>            Priority: Minor
>
> I am using DataFusion in a situation where I know there will only be a single 
> file.  DataFusion currently collects all batches into a vector.
> As I am writing the data back out I want to work with an iterator instead of 
> a vector.
> I have something as follows:
> {code:java}
> let plan = ctx.create_logical_plan(&sql).unwrap();
> let plan = ctx.optimize(&plan).unwrap();
> dbg!(plan.schema());  // Returns field names
> let plan = ctx.create_physical_plan(&plan, batch_size).unwrap();
> dbg!(plan.schema()); // Returns c0, c1, etc{code}
> Maybe this is expected after turning the plan into a physical plan?
> I can change the schema of the returned batches, would this be the 
> recommended way to address this or is there something in DataFusion I should 
> leverage to do this?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to