You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "neilconway (via GitHub)" <gi...@apache.org> on 2026/02/19 15:31:31 UTC
[I] concat_ws does unnecessary type coercion [datafusion]
neilconway opened a new issue, #20434:
URL: https://github.com/apache/datafusion/issues/20434
### Describe the bug
1. `concat_ws` returns `Utf8`, regardless of the input types it is called with. So if it is called with `LargeUtf8`, we might overflow. In general, functions like these should operate on all three string representations unless there is a compelling reason not to.
2. `simplify_concat_ws` coerces literals to `Utf8`. Again, we should generally preserve the original string type.
### To Reproduce
Note the
```
DataFusion CLI v52.1.0
> CREATE TABLE test_views AS
SELECT arrow_cast('hello', 'Utf8View') AS a, arrow_cast('world', 'Utf8View') AS b;
0 row(s) fetched.
Elapsed 0.027 seconds.
> EXPLAIN SELECT * FROM test_views WHERE concat(a, b) = a;
+---------------+-------------------------------+
| plan_type | plan |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
| | │ FilterExec │ |
| | │ -------------------- │ |
| | │ predicate: │ |
| | │ concat(a, b) = a │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ DataSourceExec │ |
| | │ -------------------- │ |
| | │ bytes: 272 │ |
| | │ format: memory │ |
| | │ rows: 1 │ |
| | └───────────────────────────┘ |
| | |
+---------------+-------------------------------+
1 row(s) fetched.
Elapsed 0.010 seconds.
> EXPLAIN SELECT * FROM test_views WHERE concat_ws(',', a, b) = a;
+---------------+-------------------------------+
| plan_type | plan |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
| | │ FilterExec │ |
| | │ -------------------- │ |
| | │ predicate: │ |
| | │ CAST(concat_ws(,, a, b) AS│ |
| | │ Utf8View) = a │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ DataSourceExec │ |
| | │ -------------------- │ |
| | │ bytes: 272 │ |
| | │ format: memory │ |
| | │ rows: 1 │ |
| | └───────────────────────────┘ |
| | |
+---------------+-------------------------------+
1 row(s) fetched.
Elapsed 0.007 seconds.
> explain SELECT concat(a, concat(a, b)) FROM test_views;
+---------------+-------------------------------+
| plan_type | plan |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
| | │ ProjectionExec │ |
| | │ -------------------- │ |
| | │ concat(test_views.a,concat│ |
| | │ (test_views.a,test_views │ |
| | │ .b)): │ |
| | │ concat(a, concat(a, b)) │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ DataSourceExec │ |
| | │ -------------------- │ |
| | │ bytes: 272 │ |
| | │ format: memory │ |
| | │ rows: 1 │ |
| | └───────────────────────────┘ |
| | |
+---------------+-------------------------------+
1 row(s) fetched.
Elapsed 0.005 seconds.
> explain SELECT concat(a, concat_ws(',', a, b)) FROM test_views;
+---------------+-------------------------------+
| plan_type | plan |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
| | │ ProjectionExec │ |
| | │ -------------------- │ |
| | │ concat(test_views.a │ |
| | │ ,concat_ws(Utf8(", │ |
| | │ "),test_views.a │ |
| | │ ,test_views.b)): │ |
| | │ concat(a, CAST(concat_ws(,│ |
| | │ , a, b) AS Utf8View)) │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ DataSourceExec │ |
| | │ -------------------- │ |
| | │ bytes: 272 │ |
| | │ format: memory │ |
| | │ rows: 1 │ |
| | └───────────────────────────┘ |
| | |
+---------------+-------------------------------+
1 row(s) fetched.
Elapsed 0.006 seconds.
```
### Expected behavior
_No response_
### Additional context
_No response_
--
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] concat_ws does unnecessary type casts [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #20434: concat_ws does unnecessary type casts
URL: https://github.com/apache/datafusion/issues/20434
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] concat_ws does unnecessary type coercion [datafusion]
Posted by "neilconway (via GitHub)" <gi...@apache.org>.
neilconway commented on issue #20434:
URL: https://github.com/apache/datafusion/issues/20434#issuecomment-3928015772
take
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org