ygf11 commented on code in PR #4666:
URL: https://github.com/apache/arrow-datafusion/pull/4666#discussion_r1053069863
##########
datafusion/core/tests/sql/joins.rs:
##########
@@ -1448,11 +1448,11 @@ async fn hash_join_with_decimal() -> Result<()> {
let state = ctx.state();
let plan = state.optimize(&plan)?;
let expected = vec![
- "Explain [plan_type:Utf8, plan:Utf8]",
- " Projection: t1.c1, t1.c2, t1.c3, t1.c4, t2.c1, t2.c2, t2.c3, t2.c4
[c1:Date32;N, c2:Date64;N, c3:Decimal128(5, 2);N, c4:Dictionary(Int32, Utf8);N,
c1:Date32;N, c2:Date64;N, c3:Decimal128(10, 2);N, c4:Dictionary(Int32,
Utf8);N]",
- " Right Join: t1.c3 = t2.c3 [c1:Date32;N, c2:Date64;N, c3:Decimal128(5,
2);N, c4:Dictionary(Int32, Utf8);N, c1:Date32;N, c2:Date64;N, c3:Decimal128(10,
2);N, c4:Dictionary(Int32, Utf8);N]",
Review Comment:
No, it succeeded without type coercion, but I think it is a coincidence.
The reason is for `decimal eq` operation, we only check value, but do not
check the `precision` and `scale` are same.
In this test, each `c3` of the two matched rows have the same value, the
`third` row is `789000` and the `fourth` is `-12312`, then it succeeded.
```rust
"+------------+------------+---------+-----+------------+------------+-----------+---------+",
"| c1 | c2 | c3 | c4 | c1 | c2 |
c3 | c4 |",
"+------------+------------+---------+-----+------------+------------+-----------+---------+",
"| | | | | | |
100000.00 | abcdefg |",
"| | | | | | 1970-01-04 |
0.00 | qwerty |",
"| | 1970-01-04 | 789.00 | ghi | 1970-01-04 | |
789.00 | |",
"| 1970-01-04 | | -123.12 | jkl | 1970-01-02 | 1970-01-02 |
-123.12 | abc |",
"+------------+------------+---------+-----+------------+------------+-----------+---------+",
```
--
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]