Skip to content

Failed to create Left anti join physical plan due to SchemaError::FieldNotFound  #4366

@mingmwang

Description

@mingmwang

Describe the bug
A clear and concise description of what the bug is.

        let ctx = create_join_context_with_null_ids("t1_id", "t2_id", repartition_joins).unwrap();
        let sql = "SELECT t1_id, t1_name FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE t1_id = t2_id and t1_id > 11) ORDER BY t1_id";
        let actual = execute_to_batches(&ctx, sql).await;
        let expected = vec![
            "+-------+---------+",
            "| t1_id | t1_name |",
            "+-------+---------+",
            "| 11    | a       |",
            "| 11    | a       |",
            "| 33    | c       |",
            "|       | e       |",
            "+-------+---------+",
        ];
        assert_batches_eq!(expected, &actual);

called Result::unwrap() on an Err value: "SchemaError(FieldNotFound { field: Column { relation: Some("t1"), name: "t1_id" }, valid_fields: Some([Column { relation: Some("t2"), name: "t2_id" }]) }) at Creating physical plan for 'SELECT t1_id, t1_name FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE t1_id = t2_id and t1_id > 11) ORDER BY t1_id': Sort: t1.t1_id ASC NULLS LAST\n Projection: t1.t1_id, t1.t1_name\n LeftAnti Join: t1.t1_id = t2.t2_id\n TableScan: t1 projection=[t1_id, t1_name]\n Filter: CAST(t1.t1_id AS Int64) > Int64(11)\n TableScan: t2 projection=[t2_id]"

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

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