Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MisterWheatley
Copy link

Prior to this PR, the RisingWave dialect used the BasePostgressAdapter implementation of def 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.

@CLAassistant
Copy link

CLAassistant commented Jul 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@georgesittas georgesittas left a 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.

Comment on lines +49 to +51
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"),
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Author

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

I was following the example set in the BasePostgresAdapter by using db

Copy link
Contributor

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.

Copy link
Author

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):
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants