Jefffrey opened a new issue, #5211:
URL: https://github.com/apache/arrow-datafusion/issues/5211
**Describe the bug**
When using Dataframe filter() it doesn't check for ambiguous columns
**To Reproduce**
```rust
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Utf8, false),
Field::new("b", DataType::Int32, false),
]));
let batch = RecordBatch::try_new(
schema,
vec![
Arc::new(StringArray::from_slice(["a", "b", "c", "d"])),
Arc::new(Int32Array::from_slice([1, 10, 10, 100])),
],
)?;
let ctx = SessionContext::new();
ctx.register_batch("t1", batch.clone())?;
ctx.register_batch("t2", batch)?;
ctx.table("t1")
.await?
.join(
ctx.table("t2").await?,
JoinType::Inner,
&["a"],
&["a"],
None,
)?
.filter(col("b").eq(lit(1)))? // ambiguous b
.explain(false, false)?
.show()
.await?;
```
Will execute fine:
```sql
+---------------+--------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+--------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Inner Join: t1.a = t2.a
|
| | Filter: t1.b = Int32(1)
|
| | TableScan: t1 projection=[a, b]
|
| | TableScan: t2 projection=[a, b]
|
| physical_plan | CoalesceBatchesExec: target_batch_size=8192
|
| | HashJoinExec: mode=Partitioned, join_type=Inner,
on=[(Column { name: "a", index: 0 }, Column { name: "a", index: 0 })] |
| | CoalesceBatchesExec: target_batch_size=8192
|
| | RepartitionExec: partitioning=Hash([Column { name:
"a", index: 0 }], 12), input_partitions=12 |
| | CoalesceBatchesExec: target_batch_size=8192
|
| | FilterExec: b@1 = 1
|
| | RepartitionExec:
partitioning=RoundRobinBatch(12), input_partitions=1
|
| | MemoryExec: partitions=1,
partition_sizes=[1]
|
| | CoalesceBatchesExec: target_batch_size=8192
|
| | RepartitionExec: partitioning=Hash([Column { name:
"a", index: 0 }], 12), input_partitions=12 |
| | RepartitionExec: partitioning=RoundRobinBatch(12),
input_partitions=1 |
| | MemoryExec: partitions=1, partition_sizes=[1]
|
| |
|
+---------------+--------------------------------------------------------------------------------------------------------------------------+
```
**Expected behavior**
Should raise error
**Additional context**
Similar has been addressed for SQL queries:
https://github.com/apache/arrow-datafusion/issues/4196
--
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]