Skip to content

When joining two tables, get Error: Plan("Schema contains duplicate unqualified field name \'xxx\'") #311

Closed

Description

@juaby
#[tokio::main]
async fn main() -> Result<()> {
    // create local execution context
    let mut ctx = ExecutionContext::new();

    let testdata = datafusion::arrow::util::test_util::arrow_test_data();

    // register csv file with the execution context
    ctx.register_csv(
        "aggregate_test_100",
        &format!("{}/csv/aggregate_test_100.csv", testdata),
        CsvReadOptions::new(),
    )?;

    ctx.register_csv(
        "aggregate_test_200",
        &format!("{}/csv/aggregate_test_100.csv", testdata),
        CsvReadOptions::new(),
    )?;

    // execute the query
    let df = ctx.sql(
        "SELECT a1.c1, MIN(a1.c12), MAX(a1.c12) \
        FROM aggregate_test_100 a1 left join aggregate_test_200 a2 on a1.c1 = a2.c1  \
        WHERE a1.c11 > 0.1 AND a1.c11 < 0.9 \
        GROUP BY a1.c1 order by a1.c1 limit 2",
    )?;
    let results = df.collect().await?;

    // print the results
    pretty::print_batches(&results)?;

    Ok(())
}

Activity

  1. changed the title [-]Error: Plan("Schema contains duplicate unqualified field name \'c1\'")[/-] [+]Error: Plan("Schema contains duplicate unqualified field name \'xxx\'")[/+] on May 10, 2021
  2. Dandandan commented on May 10, 2021

    @Dandandan
    Contributor

    Might be the same as #155
    This could be solved after this PR:
    #55

  3. houqp commented on May 10, 2021

    @houqp
    Member

    yeah, this query is definitely not going to work until we complete #55.

  4. changed the title [-]Error: Plan("Schema contains duplicate unqualified field name \'xxx\'")[/-] [+]When joining two tables, get Error: Plan("Schema contains duplicate unqualified field name \'xxx\'")[/+] on May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions