simonvandel opened a new issue, #11102:
URL: https://github.com/apache/datafusion/issues/11102
### Describe the bug
Consider the contrived query generated with this:
```python
print('SELECT * FROM VALUES(1) WHERE ' + ' OR '.join(['column1 = ' + str(i)
for i in range(10000)]))
```
It looks like this:
```sql
SELECT * FROM VALUES(1) WHERE column1 = 0 OR column1 = 1 OR column1 = 2 ...
```
Such a query overflows the stack.
### To Reproduce
```bash
python3 -c "print('SELECT * FROM VALUES(1) WHERE ' + ' OR '.join(['column1 =
' + str(i) for i in range(10000)]))" > /tmp/query.sql
datafusion-cli -f /tmp/query.sql
# output below
DataFusion CLI v39.0.0
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
```
### Expected behavior
I expected that the query ran successfully, or provided an error.
### Additional context
LLDB shows that the culprit might be that `map_children` of `Expr` is
recursive.
```
lldb datafusion-cli
settings set target.run-args -f /tmp/query.sql
run
bt
# shows deep stack trace like this
* frame #0: 0x0000555557159771
datafusion-cli`datafusion_expr::tree_node::_$LT$impl$u20$datafusion_common..tree_node..TreeNode$u20$for$u20$datafusion_expr..expr..Expr$GT$::map_children::hc2fc8c2c6eec78b5
+ 17
frame #1: 0x00005555572f4b46
datafusion-cli`datafusion_expr::tree_node::transform_box::h4a3722c597863a90 + 70
frame #2: 0x0000555557159acc
datafusion-cli`datafusion_expr::tree_node::_$LT$impl$u20$datafusion_common..tree_node..TreeNode$u20$for$u20$datafusion_expr..expr..Expr$GT$::map_children::hc2fc8c2c6eec78b5
+ 876
frame #3: 0x00005555572f4b46
datafusion-cli`datafusion_expr::tree_node::transform_box::h4a3722c597863a90 + 70
frame #4: 0x0000555557159acc
datafusion-cli`datafusion_expr::tree_node::_$LT$impl$u20$datafusion_common..tree_node..TreeNode$u20$for$u20$datafusion_expr..expr..Expr$GT$::map_children::hc2fc8c2c6eec78b5
+ 876
frame #5: 0x00005555572f4b46
datafusion-cli`datafusion_expr::tree_node::transform_box::h4a3722c597863a90 + 70
frame #6: 0x0000555557159acc
datafusion-cli`datafusion_expr::tree_node::_$LT$impl$u20$datafusion_common..tree_node..TreeNode$u20$for$u20$datafusion_expr..expr..Expr$GT$::map_children::hc2fc8c2c6eec78b5
+ 876
frame #7: 0x00005555572f4b46
datafusion-cli`datafusion_expr::tree_node::transform_box::h4a3722c597863a90 + 70
frame #8: 0x0000555557159acc
datafusion-cli`datafusion_expr::tree_node::_$LT$impl$u20$datafusion_common..tree_node..TreeNode$u20$for$u20$datafusion_expr..expr..Expr$GT$::map_children::hc2fc8c2c6eec78b5
+ 876
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]