goldmedal commented on code in PR #11452:
URL: https://github.com/apache/datafusion/pull/11452#discussion_r1681023548
##########
datafusion/functions-array/src/make_array.rs:
##########
@@ -131,6 +138,77 @@ impl ScalarUDFImpl for MakeArray {
}
}
+#[derive(Debug)]
+pub struct MakeArrayStrict {
Review Comment:
I think we can't call `make_array_inner` in `ExprPlanner`. In my opinion, it
should be used in the execution phase, but `ExprPlanner` is used in the
planning phase. Our purpose is to arrange the input expressions into two array
logical expressions (which is more efficient than arranging `ColumnarValue`).
However, I noticed that we don't have another way to create an array logical
expression aside from `make_array`. We plan any array literal to `make_array`.
```
> explain select [c1,2] from t1;
+---------------+-----------------------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+-----------------------------------------------------------------------------------------+
| logical_plan | Projection: make_array(CAST(t1.c1 AS Int64), Int64(2))
|
| | TableScan: t1 projection=[c1]
|
| physical_plan | ProjectionExec: expr=[make_array(CAST(c1@0 AS Int64), 2)
as make_array(t1.c1,Int64(2))] |
| | MemoryExec: partitions=1, partition_sizes=[1]
|
| |
|
+---------------+-----------------------------------------------------------------------------------------+
2 row(s) fetched.
Elapsed 0.008 seconds.
```
Is there any other way to aggregate the expressions into an array or list in
the planning phase?
--
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]