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

FIR-32802 use catalog parameter in getTables() & getColumns() #404

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

alexradzin
Copy link
Collaborator

No description provided.

@alexradzin alexradzin requested a review from a team as a code owner May 2, 2024 17:43
@ptiurin
Copy link
Contributor

ptiurin commented May 3, 2024

Not sure If catalogs are officially supported yet. Let's check with the relevant team before making changes. We have the columns, but do they actually represent what we want?

Base automatically changed from FIR-32797-improve-SystemEngineDatabaseMetaDataTest to master May 5, 2024 16:24
@alexradzin
Copy link
Collaborator Author

Not sure If catalogs are officially supported yet. Let's check with the relevant team before making changes. We have the columns, but do they actually represent what we want?

No, it is just a bug. We took catalog into consideration into getSchemas() but just forgot to use it in getTables() and getColumns(). Catalog == Table in our case and in many other databases. The table infomaion_schema.tables has column table_catalog. Morever this column (and similar column from table columumns is returns as a result of getTables() that actually means that the result of returned by this function may be confusing. For example one can call this function sending value foo as as catalog and get result set that supplies value bar when method resultSet.getString("table_cat") is called.

@alexradzin alexradzin force-pushed the FIR-32802-metadata-catalog branch from d860191 to 1a3a186 Compare May 6, 2024 13:44
@ptiurin
Copy link
Contributor

ptiurin commented May 8, 2024

Catalog == Table in our case and in many other databases.

We can't assume this as it's incorrect. We're aiming for Postgres compatibility and in Postgres catalog has a specific meaning. JDBC spec also has these two separate.

The table infomaion_schema.tables has column table_catalog.

Yes, but unless it's meaningful we can't start using it. That's why I'm suggesting checking with a relevant team.

@alexradzin
Copy link
Collaborator Author

alexradzin commented May 8, 2024

Again, the API exists. getCatalogs() returns one line that contain the DB name. This means that for consistency getSchemas(), getTables() and getColumns() should respect this parameter as well. At least their result should depend on the value of catalog. At least if the value is "correct", i.e. equals to one that returned by getCatalogs() the list should not be empty; otherwise should be empty.

@ptiurin
Copy link
Contributor

ptiurin commented May 8, 2024

I believe just because we're doing something already doesn't mean it's correct. What I'm saying is, please verify "catalog" matches across the board in get* calls and will stay that way.

@stepansergeevitch
Copy link
Contributor

It seems like catalogs are already supported and return the same value that postgres does
https://docs.firebolt.io/sql_reference/information-schema/tables.html

Copy link

Copy link
Contributor

@ptiurin ptiurin left a comment

Choose a reason for hiding this comment

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

LGTM, though heads-up this might be a high risk change - we're starting to filter based on previously unfiltered value. Despite this being the "right" way some users might rely on the previous functionality. Let's make sure we at least bump the minor version and include a note in release notes.

@stepansergeevitch stepansergeevitch merged commit 8a8f84c into master Oct 30, 2024
4 checks passed
@stepansergeevitch stepansergeevitch deleted the FIR-32802-metadata-catalog branch October 30, 2024 11:15
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