New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the tuple element names as column names in untuple()
#55123
Conversation
It would be also great to fix |
@UnamedRus I suppose the root caue is |
Thinking about it, it would make perfect sense with this PR especially, |
I already have 11 messages in my inbox about "Run cancelled: CherryPick - master (613f8db)", not sure what is going on? Here's a link to one of the runs: https://github.com/garcher22/ClickHouse/actions/runs/6356562956 @Felixoid maybe you can help me as the main author of that workflow upd.: looks like it somehow got enabled on my fork and was failing, although I don't remember doing anything for it... for now I disabled it manually. |
This sounds dangerous - it previous led to a bug: https://github.com/ClickHouse/ClickHouse/pull/26179/files |
This is an automated comment for commit 558b2ff with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
I believe it's better to treat |
It will be nice to support |
Right, it fails:
This should have been an assertion failure though I guess? I'm also getting some other weird errors even without my changes:
No idea what it is, probably also an assertion failure? Anyway, this looks like too much work. What about a simpler change, use tuple element names only when the untuple alias is set? This will still make the column names usable for me, and won't have this problem. I updated the PR to implement this change instead. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
untuple()
@rschu1ze, Doesn't it break query analysis?
Are you 100% sure it is not related to this pull request? |
@rschu1ze even if the memory sanitizer issue is not related to this pull request, its existence means that currently our repository is in a non-acceptable state, and nothing should be done other than fixing it. |
I extended the tests (#55425) and I am pretty sure that this particular PR does not add new problems. There is however a problem with untuple() and the analyzer in general which existed before this PR already, I opened #55426. If the problem cannot be fixed easily, then I'd be okay with removing untuple - the same can be achieved with sub-index access ( |
Function
untuple()
currently ignores the element names of named tuples and generates ugly result column names:Why would anyone want column names like this? And there's effectively no way to change these names when using
untuple()
. Let's respect the user intention and use the explicitly specified tuple element names (new behavior):Interestingly, when the
untuple()
function itself has an alias, the result column names are already usable as of now but with an index as the column name instead of the element alias. This behavior is retained by this PR for backward compatibility:When the element names are not specified, also keep the old behavior (ugly name):
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
When function "untuple()" is now called on a tuple with named elements and itself has an alias (e.g. "select untuple(tuple(1)::Tuple(element_alias Int)) AS untuple_alias"), then the result column name is now generated from the untuple alias and the tuple element alias (in the example: "untuple_alias.element_alias").