kumarUjjawal commented on PR #21739:
URL: https://github.com/apache/datafusion/pull/21739#issuecomment-4282544913
> @kumarUjjawal could you give an example of where/when the internal flag is
necessary?
A good example could be:
Internally, COUNT(*) is lowered to count(1) so it can use the normal
aggregate path. But the user did not write count(1), they wrote count(*). So
the planner needs a way to preserve that user-facing name without treating it
like a real user alias.
That is what the internal flag is for: it marks aliases that exist only
because the planner rewrote the expression.
Without that bit, physical explain cannot tell these two cases apart:
- user alias: sum(a) AS total
- planner-generated alias: lowered count(1) wrapped as count(*)
Those should display differently. For example, with:
SELECT COUNT(*) AS total_rows FROM t
there are really two alias layers:
- internal: count(1) -> count(*)
- user: count(*) -> total_rows
The internal flag lets explain show count(*) as total_rows, instead of
either exposing the lowered form count(1) as count(*) as total_rows or
collapsing everything to just total_rows.
--
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]