-
Notifications
You must be signed in to change notification settings - Fork 234
Fix: Ensure correct datatypes are fetched for RisingWave dialect #4903
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
base: main
Are you sure you want to change the base?
Fix: Ensure correct datatypes are fetched for RisingWave dialect #4903
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Seems reasonable, just a few comments to take this to the finish line.
exp.column("name", db="rw_relations").eq(table.alias_or_name), | ||
exp.column("name", db="rw_columns").neq("_row_id"), | ||
exp.column("name", db="rw_columns").neq("_rw_timestamp"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we setting db
here instead of table
?
|
||
if table.args.get("db"): | ||
sql = sql.where( | ||
exp.column("name", db="rw_schemas", quoted=False).eq(table.args["db"].name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above is directly copied from
if table.args.get("db"): |
I was following the example set in the BasePostgresAdapter
by using db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice how we only access it for table
, though. For columns, i.e. objects constructed via column
, a reference like a.b
produces a b
for this
and a
for table
. The db
part would come before a
, and similarly the catalog
part would come before the db
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification. I will update next week to use table
over db
.
I guess I was just blindly following the existing code, but did consider whether it was due to some interaction with Postgres as a single catalog engine. It seemed to work so I didn't question it too deeply.
@@ -15,6 +15,43 @@ def adapter(make_mocked_engine_adapter): | |||
return adapter | |||
|
|||
|
|||
def test_columns(adapter: t.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's include an integration test for this please, containing the problematic case you described in the description. You can create a test_integration_risingwave
, similar to other integration testing modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try and get started on this next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Prior to this PR, the RisingWave dialect used the
BasePostgressAdapter
implementation ofdef columns(..)
to fetch column names and data-types.However the PG catalog tables in RisingWave doesn't support e.g.
struct
types instead returning???
as datatype. This PR updates the RisingWave adapter to use the RisingWave catalogs instead to get correct datatypes.