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

Allow pinot table aliases #97

Merged
merged 2 commits into from
May 2, 2024

Conversation

abloom
Copy link
Contributor

@abloom abloom commented Apr 22, 2024

My team has been using this pinot driver with the SQL Alchemy ORM and ran into a bit of an issue with missing table names in JOIN clauses during execution.

When printing the generated query things look good:

SELECT table1.a, table1.b, table2.c
FROM table1
JOIN table2 ON table1.a = table2.a

but when executing the query the table names are dropped from all the columns:

SELECT a, b, c
FROM table1
JOIN table2 ON a = a

and we end up with a query that won't run because the ON a = a portion of the JOIN clause is ambiguous.

I checked the commit history for the lines I deleted and didn't learn much about their origin. Is it possible Pinot has advanced in the years since they were originally written? We've moved our code over to our fork of the driver and haven't noticed any side effects yet.

If this solution is unacceptable please let me know what I need to change.


After making the first change we noticed some queries that used to work started failing. The Pinot query planner started returning errors about CAST calls using invalid types. I've switched STRING to VARCHAR and LONG to NUMERIC and have updated the tests to reflect that.

@abloom abloom marked this pull request as draft April 23, 2024 14:48
@abloom abloom marked this pull request as ready for review April 23, 2024 19:37
@xiangfu0 xiangfu0 added the enhancement New feature or request label Apr 26, 2024
@xiangfu0 xiangfu0 merged commit 5641180 into python-pinot-dbapi:master May 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants