Columns get mutator suffix to avoid field collisions, but are not added in GROUP BY #31833
Replies: 1 comment
-
Hey there, @LudvigJuelsson! 👋 I'm here to help you with bug fixes, questions, and becoming a contributor. The Removing the mutation suffix resolved your issue because it allowed the SQL query to correctly reference the intended columns without the added suffixes, which were causing mismatches in the The use of label mutations might still be relevant in cases where there is a risk of name collisions, especially in more complex queries or when using different aggregations. It's important to weigh the benefits of avoiding potential collisions against the issues that mutations might introduce, as seen in your case. The discussions and issues you've referenced indicate that this is an ongoing topic within the community, with various solutions and workarounds being explored [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
Hello all!
I am planning to change my clickhouse database connector, from clickhouse-sqlalchemy -> clickhouse-connect. When updating however, many of my chart are breaking due to
code 215
(see point 1. Error). After doing some deep diving, I figured out that it had to do with the_mutate_label
function that adds a suffix to avoid field name collisions, and there has been some discussions regarding this before (see point 4. Previous related raised issues and discussions).By removing this functionality, I got all of my charts back to a working state, and no mutations are added.
I am a bit confused on why the mutations are still used, when removing the alias mutation suffix makes my charts work as intended.
Is there any reason for the label mutation still being used?
Or is there any special cases I am missing where it is still needed?
1. Error:
2. Rendered SQL:
The timestamp works fine even with the alias mutation, due to timestamp_d7e6d5 being the same as the timestamp column. But, the count_e2942a alias mutation is expected to come from the a 'count' column, not the rendered 'COUNT(*) which is the used metric.
3. How I solved it:
I solved it by removing the mutation in the function
_mutate_label
:superset/superset/db_engine_specs/clickhouse.py
Lines 395 to 403 in 2935557
I did this by running a sed command in my Dockerfile, like such:
This sed command simply removes the added mutation suffix and return the original field name, i.e., 'label'
4. Previous related raised issues and discussions:
#25150
#25073
These issues seemed to have solved/have a work around for some of the issues regarding alias mutations.
5. Relevant versions and Information:
Superset version==4.0.2
clickhouse-connect==0.8.13
clickhouse-sqlalchemy==0.2.7
Beta Was this translation helpful? Give feedback.
All reactions