Skip to content
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

Support expression-aggregations for BigQuery #3997

Closed
VikramTiwari opened this issue Dec 23, 2016 · 6 comments
Closed

Support expression-aggregations for BigQuery #3997

VikramTiwari opened this issue Dec 23, 2016 · 6 comments
Assignees
Milestone

Comments

@VikramTiwari
Copy link
Contributor

Feature requests and proposals

Enable bigquery to use expression-aggregations by slugging the auto-generated column names

I am trying to make this work? Could anyone help?

@camsaul camsaul changed the title BigQuery driver updates for expression-aggregations Support expression-aggregations for BigQuery Jan 17, 2017
@camsaul camsaul self-assigned this Jan 17, 2017
@camsaul
Copy link
Member

camsaul commented Jan 17, 2017

It's not currently enabled because:

Expression aggregations would work, but BigQuery doesn't support the auto-generated column names. BQ column names
can only be alphanumeric or underscores. If we slugified the auto-generated column names, we could enable this feature.

Just need to add some logic to BQ query processor to make the column names BQ-friendly

@camsaul
Copy link
Member

camsaul commented Jan 17, 2017

Related: #4087 and #4089

@VikramTiwari
Copy link
Contributor Author

@camsaul So this works fine. Except for one edge case:

If I create two custom expressions which are either same or similar in formula

cost per click = sum(cost)/sum(clicks)
cost per impression = sum(cost)/sum(impressions)

The resultant columns are same : sum___sum This results in an error from bigquery itself which results in metabase throwing following error:

2.101 - 2.195: Ambiguous column name sum___sum.

My suggestion is to re-open the issue and fix it using following strategies:

  • similar formula: pass column name along to create the query to BigQuery's AS statement as sum_column_name__sum_column_name
  • same formula: Catch it in the UI and ask the user to either give them different names or different formula

@salsakran Thoughts?

@camsaul
Copy link
Member

camsaul commented Apr 11, 2017

@VikramTiwari I just fixed that this morning, see #4089/#4753 😉

@VikramTiwari
Copy link
Contributor Author

@camsaul Sigh! I pulled it yesterday and did test just now. haha Kudos to you! 👍

@VikramTiwari
Copy link
Contributor Author

Since I could not find any existing issue:
Are there any plans to change these sum__sum to something better on UI side? Preferably without underscores. Even if I give a name to an expression, the name remains underscored.

@camsaul @tlrobinson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants