Commit e4e8598
authored
fix: Add integer check for bitwise coercion (#20241)
## Which issue does this PR close?
N/A
## Rationale for this change
In the original codebase, bitwise_coercion was implemented as follows:
```rust
if left_type == right_type {
return Some(left_type.clone());
}
```
This causes any identical types—such as floats—to pass the check during
the logical planning stage. The error only surfaces much later when the
arrow kernel attempts execution. This appears to be a minor oversight by
the original author.
## What changes are included in this PR?
```diff
- if left_type == right_type {
+ if left_type == right_type && left_type.is_integer() {
return Some(left_type.clone());
}
```
## Are these changes tested?
Yes, a new unit test is added, and all existing tests passed.
## Are there any user-facing changes?
No.1 parent 9fd84e7 commit e4e8598
3 files changed
Lines changed: 58 additions & 1 deletion
File tree
- datafusion
- expr-common/src/type_coercion
- binary/tests
- sqllogictest/test_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
231 | 278 | | |
232 | 279 | | |
233 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1311 | 1311 | | |
1312 | 1312 | | |
1313 | 1313 | | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
1314 | 1322 | | |
1315 | 1323 | | |
1316 | 1324 | | |
| |||
0 commit comments